結果

問題 No.432 占い(Easy)
ユーザー notetonous
提出日時 2017-08-12 01:47:56
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 627 ms
コンパイル使用メモリ 57,328 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-12 22:54:14
合計ジャッジ時間 1,690 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
int T;
string s,t;
int main(){
  cin >> T;
  for(int i=0;i<T;i++){
    cin >> s;
    while(s.length()>1){
      int len=s.length();
      for(int j=0;j<len;j++){
	char x=s[j]+s[j+1]-'0'-'0';
	if(x<10)s[j]=x+'0';
	else{
	  x=(x/10)+(x%10);
	  s[j]=x+'0';
	}
      }
      s.erase(s.end()-1);
    }
    cout << s << endl;
  }
  return 0;
}
0