結果
| 問題 | 
                            No.921 ずんだアロー
                             | 
                    
| コンテスト | |
| ユーザー | 
                             bal4u
                         | 
                    
| 提出日時 | 2019-11-09 08:24:50 | 
| 言語 | C  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 4 ms / 2,000 ms | 
| コード長 | 570 bytes | 
| コンパイル時間 | 287 ms | 
| コンパイル使用メモリ | 29,184 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-15 04:05:23 | 
| 合計ジャッジ時間 | 1,489 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / 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()
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