結果
問題 | No.432 占い(Easy) |
ユーザー |
![]() |
提出日時 | 2016-11-06 18:28:09 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 818 bytes |
コンパイル時間 | 1,312 ms |
コンパイル使用メモリ | 163,540 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-25 03:23:47 |
合計ジャッジ時間 | 2,256 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> //const static double de_PI = 3.14159265358979323846; //const static int de_MOD = 1000000007; //const static int de_MAX = 999999999; //const static int de_MIN = -999999999; int main(void) { //std::ifstream in("123.txt"); std::cin.rdbuf(in.rdbuf()); int T = 0; std::cin >> T; std::vector<int> ans(T); for (int i = 0; i < T; i++) { std::string S; std::cin >> S; std::vector<int> A(S.length()); for (unsigned int j = 0; j < S.length(); j++) { A[j] = S[j] - '0'; } while (A.size() > 1) { std::vector<int> nextA(A.size() - 1); for (unsigned int j = 0; j < A.size() - 1; j++) { nextA[j] = (A[j] + A[j + 1]) % 10 + (A[j] + A[j + 1]) / 10; } A.clear(); A = nextA; } ans[i] = A[0]; } for (int i = 0; i < T; i++) { std::cout << ans[i] << std::endl; } }