結果
問題 | No.432 占い(Easy) |
ユーザー |
![]() |
提出日時 | 2016-10-14 22:33:19 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 515 bytes |
コンパイル時間 | 516 ms |
コンパイル使用メモリ | 63,404 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-22 07:23:00 |
合計ジャッジ時間 | 1,622 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 |
ソースコード
#include <iostream> #include <string> #include <vector> using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; i++) { string S; cin >> S; vector<int>num; for (int j = 0; j < S.size(); j++) { num.push_back(S[j] - '0'); } while (num.size() != 1) { vector<int>tmpS; for (int k = 1; k < num.size(); k++) { int a = num[k] + num[k - 1]; if(a<10) tmpS.push_back(a); else tmpS.push_back(a % 10 + 1); } num = tmpS; } cout << num[0] << endl; } return 0; }