結果
| 問題 |
No.921 ずんだアロー
|
| コンテスト | |
| ユーザー |
bal4u
|
| 提出日時 | 2019-11-09 08:34:23 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 579 bytes |
| コンパイル時間 | 177 ms |
| コンパイル使用メモリ | 29,312 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-15 04:05:24 |
| 合計ジャッジ時間 | 1,121 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
// yuki 921 ずんだアロー
// 2019.11.9 bal4u
#include <stdio.h>
#include <ctype.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;
}
int main()
{
int p, f, A, N, ans;
N = in();
ans = 0, p = 0, f = 0;
while (N--) {
A = in();
if (A == p) ans++, f = 1;
else if (f) p = 0, f = 0;
else ans++, f = 1;
p = A;
}
printf("%d\n", ans);
return 0;
}
bal4u