結果
| 問題 | 
                            No.432 占い(Easy)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             femto
                         | 
                    
| 提出日時 | 2016-10-14 22:26:57 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 7 ms / 2,000 ms | 
| コード長 | 540 bytes | 
| コンパイル時間 | 815 ms | 
| コンパイル使用メモリ | 90,408 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-22 07:09:29 | 
| 合計ジャッジ時間 | 1,716 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 22 | 
ソースコード
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <cassert>
#include <map>
#include <set>
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int T;
	cin >> T;
	while(T--) {
		string s;
		cin >> s;
		while(s.size() > 1) {
			string t;
			for(int i = 0; i < s.size() - 1; i++) {
				int a = s[i] - '0' + s[i + 1] - '0';
				if(a >= 10) a = a / 10 + a % 10;
				t += '0' + a;
			}
			s = t;
		}
		cout << s << endl;
	}
}
            
            
            
        
            
femto