結果
| 問題 | 
                            No.432 占い(Easy)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             _Victorique__
                         | 
                    
| 提出日時 | 2016-10-14 22:59:28 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 16 ms / 2,000 ms | 
| コード長 | 594 bytes | 
| コンパイル時間 | 561 ms | 
| コンパイル使用メモリ | 64,308 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-22 08:42:21 | 
| 合計ジャッジ時間 | 1,514 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 22 | 
ソースコード
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main() {
	int t;
	string s;
	vector<string> S;
	cin >> t;
	for (int i = 0; i < t; i++) {
		cin >> s;
		while (s.size() != 1) {
			int temp;
			string ans;
			for (unsigned j = 0; j < s.size() - 1; j++) {
				temp = (int)(s[j]-'0') + (int)(s[j + 1] - '0');
				if (temp >= 10) {
					temp = (int)(to_string(temp)[0] - '0') + (int)(to_string(temp)[1] - '0');
				}
				ans += to_string(temp);
			}
			s = ans;
		}
		S.push_back(s);
	}
	for (unsigned i = 0; i < S.size(); i++) {
		cout << S[i] << endl;
	}
	return 0;
}
            
            
            
        
            
_Victorique__