結果

問題 No.1168 Digit Sum Sequence
ユーザー LV3zJigVW57oPGy
提出日時 2022-11-10 18:17:40
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 430 bytes
コンパイル時間 3,467 ms
コンパイル使用メモリ 159,952 KB
実行使用メモリ 16,960 KB
最終ジャッジ日時 2024-07-23 19:55:22
合計ジャッジ時間 8,976 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample TLE * 1 -- * 1
other -- * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h> 
using namespace std;
#include <stdio.h>
#include <iomanip>
#include <iostream>
#include <string>
#include <algorithm>

int main(){
  int a;
  cin >> a;
  int count=0;
  while(true){
    string str;
    str = to_string(a);
    	for(int i=0;str.size();i++){
     	 int b = a%10;
     	 a = a/10;
     	 count += b;
    	}
    a = count;
   		 if(a/10==0){
    	  break;
  	      }
  }
  cout << a;
}
      
0