:: ADVANCE ::

85일차 1. ladder 본문

Algorithm/일일알고리즘

85일차 1. ladder

KSJ14 2014. 10. 2. 16:17
반응형

http://183.106.113.109/30stair/ladder/ladder.php?pname=ladder

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <iostream>
using namespace std;
 
int ladder[100];
 
int main(void)
{
    int col, row, path;
    char alpha = 'A';
    cin >> col >> row;
 
    for(int i = 0; i < row; i++)    {
        cin >> ladder[i];
    }
 
    for(int i = 1; i <= col; i++)    {
        path = i;
        for(int j = 0; j < row; j++)    {
            if(ladder[j] == path)    {
                path++;
            }
            else if(ladder[j] == path-1)    {
                path--;
            }
        }
        printf("%d %c\n", i, alpha + path-1);
    }
 
    return 0;
}

 

반응형

'Algorithm > 일일알고리즘' 카테고리의 다른 글

90일차 1. sprime  (0) 2014.10.08
91일차 1. eratosthenes  (0) 2014.10.07
86일차 1. ncpc_event  (0) 2014.10.02
84일차 1. cryption  (0) 2014.09.30
83일차 1. cantoring  (0) 2014.09.30
Comments