結果
問題 |
No.1168 Digit Sum Sequence
|
ユーザー |
![]() |
提出日時 | 2022-11-10 19:04:52 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 440 bytes |
コンパイル時間 | 1,683 ms |
コンパイル使用メモリ | 161,532 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-23 20:35:52 |
合計ジャッジ時間 | 2,684 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <stdio.h> #include <iomanip> #include <iostream> #include <string> #include <algorithm> int main(){ int a; cin >> a; while(true){ string str; str = to_string(a); int count =0; for(int i=0;i<str.size();i++){ int b = a%10; a = a/10; count += b; } a = count; if(a/10==0){ break; } } cout << a; }