結果

問題 No.432 占い(Easy)
ユーザー toto6114
提出日時 2019-07-04 22:49:13
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 629 ms
コンパイル使用メモリ 72,232 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-19 06:48:54
合計ジャッジ時間 1,367 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int T;
  string s;
  cin >> T;
  for(int i=0; i<T; i++) {
      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 << endl;
  }
}
0