結果

問題 No.432 占い(Easy)
ユーザー IchimiyaIchimiya
提出日時 2020-07-23 20:56:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 733 bytes
コンパイル時間 1,496 ms
コンパイル使用メモリ 167,056 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 00:31:51
合計ジャッジ時間 2,828 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 5 ms
4,376 KB
testcase_12 AC 31 ms
4,380 KB
testcase_13 AC 31 ms
4,376 KB
testcase_14 AC 5 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 29 ms
4,380 KB
testcase_18 AC 17 ms
4,376 KB
testcase_19 AC 11 ms
4,376 KB
testcase_20 AC 6 ms
4,376 KB
testcase_21 AC 7 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 3 ms
4,376 KB
testcase_25 AC 3 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
const int64_t MOD = 1e9 + 7;

int main() {
	int T;
	cin >> T;

	for (int i = 0; i < T; i++) {
		string s;
		cin >> s;

		//for (int j = 0; j < s.size(); j++) {
		//	cout << s.at(j) << endl;
		//}

		while (s.size() > 1) {
			for (int j = 0; j < s.size() - 1; j++) {
				string a, b;
				a = s.at(j);
				b = s.at(j + 1);
				//cout << j << endl;
				//cout << "a:" << a << ' ' << "b:" << b << endl;

				int n, m;
				n = stoi(a);
				m = stoi(b);
				//cout << "n:" << n << ' ' << "m:" << m << endl;

				n += m;
				if (n > 9) {
					n = n / 10 + n % 10;
				}

				s.at(j) = (char)n + 48;
			}

			s = s.substr(0, s.size() - 1);
		}

		cout << s << endl;
	}
}
0