結果
問題 | No.432 占い(Easy) |
ユーザー |
![]() |
提出日時 | 2016-10-14 22:36:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 858 bytes |
コンパイル時間 | 997 ms |
コンパイル使用メモリ | 97,120 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-22 07:27:50 |
合計ジャッジ時間 | 1,920 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 |
ソースコード
#define _USE_MATH_DEFINES #include<stdio.h> #include<string> #include<iostream> #include<cctype> #include<cstdio> #include<vector> #include<stack> #include <algorithm> #include<math.h> #include<set> #include<map> #include<iomanip> using namespace std; int check(string s) { string t; if (s.length() == 1) { return s[0] - '0'; } do { for (int i = 0; i < s.length() - 1;i++) { int x = ((s[i] - '0') + (s[i + 1] - '0')); if (x < 10) { t += (x + '0'); } else { t += (1 + x % 10 + '0'); } } if (t.length() == 1) { return t[0] - '0'; } s = t; t.clear(); } while (1); } int main() { cin.tie(0); ios::sync_with_stdio(false); int T; cin >> T; vector<string> S(T); for (int i = 0; i < T; i++) { cin >> S[i]; //cout << check(S[i]) << endl; } for (int i = 0; i < T;i++) { cout << check(S[i]) << endl; } return 0; }