結果

問題 No.432 占い(Easy)
ユーザー Mayimg
提出日時 2019-01-01 00:42:04
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 467 bytes
コンパイル時間 1,609 ms
コンパイル使用メモリ 169,640 KB
実行使用メモリ 183,008 KB
最終ジャッジ日時 2024-10-13 13:13:47
合計ジャッジ時間 5,079 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 TLE * 1
other -- * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0); 

	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', b = s[i + 1] - '0';
				if(a + b > 9) {
					t += to_string((a + b) % 10) + to_string((a + b) / 10);
				} else {
					t += (a + b) + '0';
				}
			}
			s = t;
		}
		cout << s << endl;
	}
	return 0;
}
0