結果

問題 No.432 占い(Easy)
ユーザー pekempeypekempey
提出日時 2016-10-14 22:23:58
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 1,662 ms
コンパイル使用メモリ 159,520 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-22 07:06:51
合計ジャッジ時間 2,482 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
	int T;
	cin >> T;
	while (T--) {
		string s;
		cin >> s;

		while (s.size() > 1) {
			string t = s;
			s = "";
			for (int i = 0; i < t.size() - 1; i++) {
				int x = t[i] - '0' + t[i + 1] - '0';
				while (x >= 10) {
					x = (x % 10) + (x / 10);
				}
				s += x + '0';
			}
		}

		cout << s << endl;
	}
}
0