結果
| 問題 |
No.434 占い
|
| コンテスト | |
| ユーザー |
kei
|
| 提出日時 | 2016-10-14 23:02:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 858 bytes |
| コンパイル時間 | 865 ms |
| コンパイル使用メモリ | 93,940 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-11-22 09:26:20 |
| 合計ジャッジ時間 | 24,798 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 TLE * 7 |
ソースコード
#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;
}
kei