結果
| 問題 | 
                            No.432 占い(Easy)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             focus
                         | 
                    
| 提出日時 | 2018-04-01 14:46:57 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 31 ms / 2,000 ms | 
| コード長 | 519 bytes | 
| コンパイル時間 | 623 ms | 
| コンパイル使用メモリ | 66,380 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-26 04:46:00 | 
| 合計ジャッジ時間 | 1,807 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 22 | 
ソースコード
#include<iostream>
#include<cstdlib>
#include<string>
using namespace std;
int main(){
    string s,tmp;
    int num,n;
    cin >> n;
    while(n--){
        cin >> s;
        while(s.size()!=1){
            tmp.clear();
            for(int i=0;i<s.size()-1;i++){
                num = int(s[i]-'0')+int(s[i+1]-'0');
                if(num>=10) num-=9;
                tmp=tmp+to_string(num);
            }
            s = tmp;
            //cout << s << endl;
        }
        cout << s << endl;
    }
    return 0;
}
            
            
            
        
            
focus