close

https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2161

 

#include<iostream>

#include<cstdio>

#include<cstring>

 

using namespace std;

 

main(){

    int t, ca;

    int i, j, site, k;

    char word[1200];

 

    cin >> t;

    getchar();

    getchar();

    ca = 0;

    while(t--){

        cout << "Case #" << ++ca << ":" << endl;

        while (gets(word)){

            if (word[0] == '\0')

                break;

            for (i = 0, site = 1, k = 1; word[i] != '\0'; i++, k++){

                if (word[i] ==' ')

                    k = 0;

                if (k == site) {

                    cout << word[i];

                    k++;

                    site++;

                }

            }

            cout << endl;

        }

        if (t)

            cout << endl;

    }

    return 0;

}

 

arrow
arrow
    文章標籤
    UVA11220 Decoding the message
    全站熱搜

    楓綺 發表在 痞客邦 留言(0) 人氣()