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 31 | #include <cstdio>using namespace std;int main(){ for (int T = 1; T <= 10; T++) { char code[100] = { 0 }; int length, olength; scanf("%d %s", &length, &code); while (1) { olength = length; for (int i = 1; i<length; i++) { if (code[i - 1] == code[i]) { for (int j = i + 1; j<length; j++) code[j - 2] = code[j]; length -= 2; break; } } if (length == olength) break; } printf("#%d ",T); for (int i = 0; i<olength; i++) printf("%c", code[i]); putchar(10); }} |
'알고리즘 문제 풀이 > 1DP_과제(~180615)' 카테고리의 다른 글
| 171107_암호문3 (0) | 2017.11.07 |
|---|---|
| 171107_최소힙 (0) | 2017.11.07 |
| 171105_1228_암호문1 (0) | 2017.11.05 |
| 171104_1225_암호생성기 (0) | 2017.11.04 |
| 171103_1221_GNS (0) | 2017.11.03 |