結果
| 問題 |
No.239 にゃんぱすー
|
| ユーザー |
カルロス
|
| 提出日時 | 2015-09-18 16:29:13 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 573 bytes |
| コンパイル時間 | 328 ms |
| コンパイル使用メモリ | 21,888 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-19 06:55:05 |
| 合計ジャッジ時間 | 1,064 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:11:21: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[31]’ [-Wformat=]
11 | scanf("%s", &s);
| ~^ ~~
| | |
| | char (*)[31]
| char *
main.c:7:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d", &N);
| ^~~~~~~~~~~~~~~
main.c:11:13: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%s", &s);
| ^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <string.h>
int main(void){
int i, j, N, renchon = 0, cnt = 0;
char s[31];
scanf("%d", &N);
int villager[101] = {0};
for(i=1;i<=N;i++){
for(j=1;j<=N;j++){
scanf("%s", &s);
if(!strcmp(s, "nyanpass")){
villager[j]++;
}
}
}
for(i=1;i<=N;i++){
if(villager[i]==N-1){
renchon = i;
cnt++;
}
}
if(renchon!=0 && cnt==1){
printf("%d\n", renchon);
}else{
printf("-1\n");
}
return 0;
}
カルロス