結果

問題 No.432 占い(Easy)
ユーザー michonz4
提出日時 2019-12-23 08:18:14
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 394 bytes
コンパイル時間 735 ms
コンパイル使用メモリ 64,256 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-15 08:51:57
合計ジャッジ時間 1,598 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

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

  string s, tmp;
  for (int i=0; i<t; i++) {
    cin >> s;

    while (s.size()>1) {
      for (int j=1; j<s.size(); j++) {
        int t;
        t=s[j]-'0'+s[j-1]-'0';

        if (t>=10) t=1+(t%10);
        tmp+=(t+'0');
      }
      s=tmp;
      tmp="";
    }
    
    cout << s << endl;
  }

}
0