結果
| 問題 | No.24 数当てゲーム | 
| コンテスト | |
| ユーザー |  latte0119 | 
| 提出日時 | 2015-04-30 21:31:11 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 589 bytes | 
| コンパイル時間 | 1,179 ms | 
| コンパイル使用メモリ | 157,376 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-05 17:14:49 | 
| 合計ジャッジ時間 | 1,707 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%d",&N);
      |     ~~~~~^~~~~~~~~
main.cpp:9:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         for(int j=0;j<4;j++)scanf("%d",&a[j]);
      |                             ~~~~~^~~~~~~~~~~~
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%s",str);
      |         ~~~~~^~~~~~~~~~
            
            ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
    int cnt[10]={0},N;
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        int a[4];
        char str[8];
        for(int j=0;j<4;j++)scanf("%d",&a[j]);
        scanf("%s",str);
        if(str[0]=='N'){
            for(int j=0;j<4;j++){
                cnt[a[j]]=INT_MIN;
            }
        }
        else{
            for(int j=0;j<4;j++)cnt[a[j]]++;
        }
    }
    int ma=INT_MIN,val;
    for(int i=0;i<10;i++){
        if(cnt[i]>ma){
            ma=cnt[i];
            val=i;
        }
    }
    printf("%d\n",val);
}
            
            
            
        