結果

問題 No.279 木の数え上げ
ユーザー cwwcww
提出日時 2015-09-26 23:47:46
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 914 bytes
コンパイル時間 1,357 ms
コンパイル使用メモリ 23,932 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-26 16:41:32
合計ジャッジ時間 3,604 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1 ms
4,380 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <string.h>
//Sを自由に並び替えたときに作ることができる"tree"という部分文字列の数の
//最大値を1行で出力してください。改行を忘れないこと。
int main(){
    
    char s[1000];
    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;
        }
        i++; 
    }
    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