結果
問題 |
No.434 占い
|
ユーザー |
![]() |
提出日時 | 2016-10-14 23:39:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 640 bytes |
コンパイル時間 | 656 ms |
コンパイル使用メモリ | 67,984 KB |
実行使用メモリ | 13,636 KB |
最終ジャッジ日時 | 2024-11-22 06:47:34 |
合計ジャッジ時間 | 25,460 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 TLE * 7 |
ソースコード
#include <iostream> #include <cstdio> #include <cmath> #include <vector> #include <string> #include <algorithm> using namespace std; int main(){ int t; cin >> t; vector<string> s(t); for(int i=0; i<t; i++) cin >> s[i]; for(int i=0; i<t; i++){ string a = s[i]; if( a.size() == 1 ){ cout << a << endl; }else{ int p = 1; for(int j=0; j<s[i].size(); j++){ for(int k=0; k<s[i].size()-p; k++){ int tmp = a[k]-'0' + a[k+1]-'0'; if( tmp >= 10 ){ a[k] = to_string( tmp/10 + tmp%10 )[0]; }else{ a[k] = to_string(tmp)[0]; } } p++; } cout << a[0] << endl; } } return 0; }