結果

問題 No.434 占い
ユーザー confconf
提出日時 2016-10-14 23:02:31
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 690 bytes
コンパイル時間 646 ms
コンパイル使用メモリ 66,512 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-05-02 00:32:41
合計ジャッジ時間 4,739 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,752 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 291 ms
5,376 KB
testcase_09 AC 30 ms
5,376 KB
testcase_10 AC 5 ms
5,376 KB
testcase_11 AC 4 ms
5,376 KB
testcase_12 AC 17 ms
5,376 KB
testcase_13 AC 278 ms
5,376 KB
testcase_14 AC 29 ms
5,376 KB
testcase_15 TLE -
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 <queue>
#include <utility>
using namespace std;
int main(){
    int T;
    cin>>T;
    while(T--){
        string S;
        cin>>S;
        queue<int> Q1,Q2;
        while(!Q1.empty())Q1.pop();
        while(!Q2.empty())Q2.pop();
        for(auto c:S){
            Q1.push(c-'0');
        }
        while(Q1.size()>1){
            int i=Q1.front();
            Q1.pop();
            while(!Q1.empty()){
                Q2.push((i+Q1.front()>=10)?((i+Q1.front())/10+(i+Q1.front())%10):(i+Q1.front()));
                i=Q1.front();
                Q1.pop();
            }
            swap(Q1,Q2);
        }
        cout<<Q1.front()<<endl;
    }

    return 0;
}
0