結果

問題 No.933 おまわりさんこいつです
ユーザー bal4ubal4u
提出日時 2019-11-30 10:55:52
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 860 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 29,572 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-13 08:09:42
合計ジャッジ時間 1,441 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

// yuki 933 おまわりさんこいつです
// 2019.11.30 bal4u

#include <stdio.h>
#include <ctype.h>
#include <string.h>

int getchar_unlocked(void);
#define gc() getchar_unlocked()

int in() {   // 非負整数の入力
	int n = 0; int c;
	do c = gc();
	while (isspace(c));
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

void ins(char *s) {
	int c;
	while (isspace(c = gc()));
	do *s++ = c;
	while ((c = gc()) >= '0');
	*s = 0;
}

int s2c(char *s) {
	int a = 0;
	while (*s) a += *s++ & 0xf;
	return a;
}

int i2c(int n) {
	int a = 0;
	while (n) a += n % 10, n /= 10;
	return a;
}

int main()
{
	int i, N, t, ans;
	char P[30];
	
	ans = 1;
	N = in();
	while (N--) {
		ins(P);
		t = s2c(P);
		if (t == 0) { puts("0"); return 0; }
		ans = i2c(ans * t);
	}
	while (ans >= 10) ans = i2c(ans);
	putchar(ans+'0'), putchar('\n');
	return 0;
}
0