結果

問題 No.910 素数部分列
ユーザー bal4u
提出日時 2019-11-16 15:47:09
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 570 bytes
コンパイル時間 344 ms
コンパイル使用メモリ 28,800 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-24 18:04:45
合計ジャッジ時間 1,745 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

// yuki 915 Plus Or Multiple Operation
// 2019.11.16 bal4u

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

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

char S[200005];
int ans, n1, n9;

int main()
{
	int c;
	
    while (gc() >= '0');
    while ((c = gc()) > ' ') {
        if (c & 6) ans++;
        else if ((c & 8) == 0) n1++;
        else {
            if (n1) ans++, n1--;
            else n9++;
        }
    }
    n9 >>= 1;
    if (n1 <= n9) ans += n1;
    else {
        ans += n9, n1 -= n9;
        ans += n1/2;
    }
    printf("%d\n", ans);
	return 0;
}
0