結果
| 問題 | 
                            No.432 占い(Easy)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             conf
                         | 
                    
| 提出日時 | 2016-10-14 22:34:08 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 5 ms / 2,000 ms | 
| コード長 | 690 bytes | 
| コンパイル時間 | 636 ms | 
| コンパイル使用メモリ | 66,744 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-22 07:23:15 | 
| 合計ジャッジ時間 | 1,463 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 22 | 
ソースコード
#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;
}
            
            
            
        
            
conf