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