結果

問題 No.279 木の数え上げ
ユーザー cww
提出日時 2015-09-26 23:47:46
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 914 bytes
コンパイル時間 752 ms
コンパイル使用メモリ 20,736 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-19 10:46:10
合計ジャッジ時間 3,223 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 9 RE * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:13:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |     scanf("%s",s);
      |     ^~~~~~~~~~~~~

ソースコード

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