結果

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

ソースコード

diff #

#include<iostream>
#include<string>

using namespace std;

int main() {
	int i, j, n, l, a[10000];
	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