結果

問題 No.432 占い(Easy)
ユーザー 0w1
提出日時 2016-11-24 16:01:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 473 bytes
コンパイル時間 1,582 ms
コンパイル使用メモリ 168,796 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-27 10:33:51
合計ジャッジ時間 2,509 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

signed main(){
  int T; cin >> T;
  for( int i = 0; i < T; ++i ){
    string S; cin >> S;
    while( S.size() > 1 ){
      string t;
      for( int i = 0; i + 1 < S.size(); ++i ){
        int x = S[ i ] + S[ i + 1 ] - 2 * '0';
        if( x < 10 )
          t += ( char ) ( '0' + x );
        else
          t += ( char ) ( '0' + x / 10 + x % 10 );
      }
      swap( t, S );
    }
    cout << S << endl;
  }
  return 0;
}

 
0