結果
| 問題 |
No.349 干支の置き物
|
| コンテスト | |
| ユーザー |
Bantako
|
| 提出日時 | 2017-07-18 20:27:19 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 452 bytes |
| コンパイル時間 | 519 ms |
| コンパイル使用メモリ | 37,172 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-08 10:58:33 |
| 合計ジャッジ時間 | 1,311 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
5 | main(){
| ^~~~
main.cpp: In function ‘int main()’:
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d",&N);
| ~~~~~^~~~~~~~~
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%s",S);
| ~~~~~^~~~~~~~
ソースコード
#include<stdio.h>
#include<string.h>
#include<algorithm>
int num[12];
main(){
int N;
scanf("%d",&N);
char str[12][8] = {"ne","ushi","tora","u","tatsu","mi","uma","hitsuji","saru","tori","inu","i"};
for(int i = 0;i < N;i++){
char S[8];
scanf("%s",S);
for(int j = 0;j < 12;j++){
if(!strcmp(S,str[j]))num[j]++;
}
}
std::sort(num,num+12);
printf("%s\n",N/2+N%2>=num[11]?"YES":"NO");
}
Bantako