結果

問題 No.239 にゃんぱすー
ユーザー funakoshi
提出日時 2019-08-19 15:39:35
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 772 bytes
コンパイル時間 1,577 ms
コンパイル使用メモリ 28,928 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-04 11:18:44
合計ジャッジ時間 1,447 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 17 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
int main(void)
{
    int people;
    int villger[150]={0};
    char greeting[50]="";
    scanf("%d",&people);
    for(int i=0;i<people;i++)
    {
        for(int j=0;j<people;j++)
        {
            scanf("%s",greeting);
            if(strcmp(greeting,"nyanpass")==0)
            {
                villger[j]++;
            }
        }
    }
    int nyanpass=-1;
    int maxgreetcnt=-1;
    for(int i=0;i<people-1;i++)
    {        
        if(maxgreetcnt<villger[i])
        {
            maxgreetcnt=villger[i];
            nyanpass=i+1;
        }
        else if(maxgreetcnt==villger[i])
        {
            nyanpass=-1;
            break;
        }
    }
    printf("%d",nyanpass);
}
0