結果

問題 No.432 占い(Easy)
ユーザー Mayimg
提出日時 2019-01-01 00:53:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 417 bytes
コンパイル時間 1,500 ms
コンパイル使用メモリ 167,240 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-13 13:43:50
合計ジャッジ時間 2,392 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

	int t;
	cin >> t;
	for(int i = 0; i < t; i++) {
		string s;
		cin >> s;
		while(s.size() != 1) {
			string t = "";
			for(int j = 0; j < s.size() - 1; j++) {
				int a = (s[j] - '0') + (s[j + 1] - '0');
				int b = a / 10 + a % 10;
				t += to_string(b);
			}
			s = t;
		}
		cout << s << '\n';
	}
	return 0;
}
0