結果
| 問題 | No.933 おまわりさんこいつです |
| コンテスト | |
| ユーザー |
bal4u
|
| 提出日時 | 2019-11-30 10:55:52 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 2,000 ms |
| コード長 | 860 bytes |
| 記録 | |
| コンパイル時間 | 235 ms |
| コンパイル使用メモリ | 30,592 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-21 01:05:30 |
| 合計ジャッジ時間 | 1,188 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
// 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;
}
bal4u