結果
| 問題 |
No.239 にゃんぱすー
|
| コンテスト | |
| ユーザー |
FF256grhy
|
| 提出日時 | 2016-05-18 20:41:24 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 636 bytes |
| コンパイル時間 | 124 ms |
| コンパイル使用メモリ | 23,040 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-06 05:38:46 |
| 合計ジャッジ時間 | 1,037 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 26 WA * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
main.cpp:21:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
21 | scanf("%s", a[i][j]);
| ~~~~~^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int n, b[100];
char a[100][100][31];
char nya[] = "nyanpass";
int eq(char s[], char t[]) {
int i = 0;
while(s[i] != '\0' && t[i] != '\0') {
if(s[i] != t[i]) { return 0; }
i++;
}
return (s[i] == t[i]);
}
int main(void) {
scanf("%d", &n);
int i, j;
for(i = 0; i < n; i++) {
for(j = 0; j < n; j++) {
scanf("%s", a[i][j]);
}
}
for(j = 0; j < n; j++) {
for(i = 0; i < n; i++) {
if(i == j) { continue; }
if( ! eq(a[i][j], nya) ) {
b[j] = 1;
break;
}
}
}
int c = 0, p = -2;
for(i = 0; i < n; i++) {
if(b[i] == 0) {
p = i;
c++;
}
}
printf("%d\n", p + 1);
return 0;
}
FF256grhy