結果
問題 |
No.279 木の数え上げ
|
ユーザー |
![]() |
提出日時 | 2016-01-31 02:37:06 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 518 bytes |
コンパイル時間 | 113 ms |
コンパイル使用メモリ | 23,296 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-14 15:24:37 |
合計ジャッジ時間 | 898 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:12:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%s",s); | ~~~~~^~~~~~~~
ソースコード
#include<stdio.h> #include<string.h> int main(void){ char s[1000000]; int i; int num_t=0; int num_r=0; int num_e=0; int num_tree=0; scanf("%s",s); //抽出 for(i=0;i<strlen(s);i++){ switch(s[i]){ case 't':num_t++;break; case 'r':num_r++;break; case 'e':num_e++;break; default:break; } } //木が何個作れるか for(i=0;i<num_t;i++){ if(num_r>0 && num_e/2>0){ num_tree++; num_r--; num_e-=2; } } printf("%d\n",num_tree); return 0; }