結果

問題 No.434 占い
ユーザー yoichi-eyoichi-e
提出日時 2016-10-14 23:55:25
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 578 bytes
コンパイル時間 652 ms
コンパイル使用メモリ 60,560 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-05-01 23:30:48
合計ジャッジ時間 3,936 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
13,756 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 3 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    int K;
    cin>>K;
    for(int i=0;i<K;i++){
        string s;
        cin>>s;
        if(s.size()==1) {cout<<s<<endl;continue;}
        while(1){
            string c;
            for(int j=0;j<s.size()-1;j++) {
                int x = s[j] - '0' + s[j+1] - '0';
                if ( x > 9 ) c = c + to_string(1+x%10);
                else c = c + to_string(x);
            }
            if(c.size() == 1 ) {cout<<c<<endl;break;}
            s = c;
        }
    }
    return 0;
}
0