結果
問題 | No.239 にゃんぱすー |
ユーザー |
![]() |
提出日時 | 2025-03-26 10:20:20 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 831 bytes |
コンパイル時間 | 342 ms |
コンパイル使用メモリ | 26,112 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-26 10:20:22 |
合計ジャッジ時間 | 1,994 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
コンパイルメッセージ
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] == n-1){particular = i+1;count++;}if(count > 1){break;}}if(count == 1){printf("%d",particular);}else{printf("-1");}}