結果

問題 No.279 木の数え上げ
ユーザー Maeda
提出日時 2025-03-07 16:43:19
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 594 bytes
コンパイル時間 462 ms
コンパイル使用メモリ 25,472 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2025-03-07 16:43:21
合計ジャッジ時間 2,019 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%s",p);
      |     ^~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void){
    char p[10000000];
    int count[3] = {0,0,0};
    scanf("%s",p);
    char *ptr = &p[0];
    int i = 0;
    while(*(ptr+i) != '\0'){
        if(*(ptr+i) == 't'){
            count[0]++;
        }
        if(*(ptr+i) == 'r'){
            count[1]++;
        }
        if(*(ptr+i) == 'e'){
            count[2]++;
        }
        i++;
    }
    count[2] = count[2]/2;
    int max = count[0] , min = count[0];
    for(i = 0;i < 3;i++){
        if(min > count[i]){
            min = count[i];
        }
    }
    
    printf("%d\n",min);
   
    return 0;
}
0