結果

問題 No.434 占い
ユーザー LogicR_piman
提出日時 2016-10-20 23:17:10
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 415 bytes
コンパイル時間 586 ms
コンパイル使用メモリ 55,332 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-11-22 16:55:03
合計ジャッジ時間 13,272 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 24 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>

using namespace std;

int main() {
	int i, j, n, l, a[100000];
	string s;

	cin >> n;

	for (j = 0; j < n; j++) {
		cin >> s;

		l = s.length();

		for (i = 0; i < l; i++) {
			a[i] = (s[i]) - 48;
		}

		while (l != 1) {
			for (i = 0; i < l - 1; i++) {
				a[i] += a[i + 1];
				if (a[i] > 9) {
					a[i] -= 9;
				}
			}
			l -= 1;
		}
		cout << a[0] << endl;
	}

	return 0;
}
0