結果

問題 No.279 木の数え上げ
ユーザー cwwcww
提出日時 2015-09-26 23:54:41
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 702 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 21,376 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 16:06:41
合計ジャッジ時間 1,048 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 6 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 5 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 6 ms
5,376 KB
testcase_15 AC 6 ms
5,376 KB
testcase_16 AC 5 ms
5,376 KB
testcase_17 AC 6 ms
5,376 KB
testcase_18 AC 4 ms
5,376 KB
testcase_19 AC 6 ms
5,376 KB
testcase_20 AC 6 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:11:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |     scanf("%s",s);
      |     ^~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <string.h>
int main(){
    
    char s[1000050];
    int i,len;
    int count1 = 0;
    int count2 = 0;
    int count3 = 0;
    
    scanf("%s",s);
    
    len = strlen(s);
    
    for(i=0; i<len; i++){
        if(s[i]=='t'){
            count1++;
            continue;
        }else if(s[i]=='r'){
            count2++;
            continue;
        }else if(s[i]=='e'){
            count3++;
            continue;
        }
    }
    count3/=2;

    if(count1 <= count2 && count1 <= count3){
        printf("%d\n",count1);
    }else if(count2 <= count1 && count2 <= count3){
        printf("%d\n",count2);
    }else{
        printf("%d\n",count3);
    }    
	return 0;
}
0