結果
| 問題 |
No.239 にゃんぱすー
|
| ユーザー |
Maeda
|
| 提出日時 | 2025-03-26 10:17:51 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 829 bytes |
| コンパイル時間 | 345 ms |
| コンパイル使用メモリ | 26,368 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-26 10:17:54 |
| 合計ジャッジ時間 | 1,871 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 25 WA * 8 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d",&n);
| ^~~~~~~~~~~~~~
main.c:13:13: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%s",greeting);
| ^~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void main(void){
int n;
scanf("%d",&n);
int greetingList[100] = {};
//int *greetingList = (int *)calloc(n,sizeof(int));
for(int i = 0 ; i < n ; i ++){
for(int j = 0 ; j < n ; j++){
char greeting[100] = "a";
scanf("%s",greeting);
if(strcmp(greeting,"nyanpass") == 0){
//(greetingList+j) = (greetingList+j) + 1;
greetingList[j]++;
}
}
}
int particular = 0,count = 0;
for(int i = 0 ; i < n ; i++){
if(greetingList[i] != 0){
particular = i+1;
count++;
}
if(count > 1){
break;
}
}
if(count == 1){
printf("%d",particular);
}else{
printf("-1");
}
}
Maeda