結果
| 問題 | 
                            No.432 占い(Easy)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             mizzsig
                         | 
                    
| 提出日時 | 2017-02-04 18:06:16 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 11 ms / 2,000 ms | 
| コード長 | 403 bytes | 
| コンパイル時間 | 695 ms | 
| コンパイル使用メモリ | 65,020 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-24 06:17:04 | 
| 合計ジャッジ時間 | 1,721 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 22 | 
ソースコード
#include <string>
#include <iostream>
using namespace std;
int main() {
	int t;
	cin >> t;
	string s;
	while(t-- > 0){
		cin >> s;
		
		while(s.length() > 1){
			string next = "";
			
			for(int i = 0; i < s.length() - 1; i++){
				int tmp = (s[i] - '0') + (s[i+1] - '0');
				if(tmp >= 10) tmp -= 9;
				
				next += to_string(tmp);
			}
			
			s = next;
		}
		
		cout << s << endl;
	}
	return 0;
}
            
            
            
        
            
mizzsig