結果

問題 No.1168 Digit Sum Sequence
ユーザー warm4C0
提出日時 2022-07-30 11:32:52
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 246 bytes
コンパイル時間 1,469 ms
コンパイル使用メモリ 157,784 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-20 07:48:17
合計ジャッジ時間 2,227 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
	int n;
	cin >> n;

	int x = n;
	for (int i = 1; i < 100; i++) {
		int t = x, sum = 0;
		while (t > 0) {
			sum += t%10;
			t /= 10;
		}
		x = sum;
	}

	cout << x << endl;

	return 0;
}
0