結果

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

ソースコード

diff #

#include<iostream>
#include<string>

using namespace std;

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