結果
問題 |
No.279 木の数え上げ
|
ユーザー |
![]() |
提出日時 | 2025-03-27 11:51:50 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 564 bytes |
コンパイル時間 | 369 ms |
コンパイル使用メモリ | 28,800 KB |
実行使用メモリ | 11,392 KB |
最終ジャッジ日時 | 2025-03-27 11:51:52 |
合計ジャッジ時間 | 1,827 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%s",str); | ~~~~~^~~~~~~~~~
ソースコード
#include <stdio.h> #include <string.h> int main(){ char str[10000000]; scanf("%s",str); int templates[3] = {0,0,0}; int len = strlen(str); for(int i = 0;i < len;i ++){ if(str[i] == 't'){ templates[0]++; }else if(str[i] == 'r'){ templates[1]++; }else if(str[i] == 'e'){ templates[2]++; } } templates[2] /= 2; for(int i = 0;i < 3;i ++){ for(int j = 0;j < 3;j ++){ if(templates[i] < templates[j]){ int tmp = templates[i]; templates[i] = templates[j]; templates[j] = tmp; } } } printf("%d",templates[0]); }