結果
| 問題 |
No.239 にゃんぱすー
|
| ユーザー |
184
|
| 提出日時 | 2015-07-10 22:40:33 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 500 bytes |
| コンパイル時間 | 249 ms |
| コンパイル使用メモリ | 39,936 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-08 02:02:34 |
| 合計ジャッジ時間 | 1,183 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:44: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | char s[101][101][31]={};int n;scanf("%d",&n);
| ~~~~~^~~~~~~~~
main.cpp:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%s",s[i][j]);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
char s[101][101][31]={};int n;scanf("%d",&n);
int b[101];
for(int i=0;i<n;i++)b[i]=-1;
for(int i=0;i<n;i++)for(int j=0;j<n;j++){
scanf("%s",s[i][j]);
if(i==j)continue;
if(strcmp(s[i][j],"nyanpass")==0){
if(b[j])b[j]=1;
}
else b[j]=0;
}
int ans=0,cnt=0;
for(int i=0;i<n;i++)if(b[i]==1){ans=i+1;cnt++;}
if(cnt!=1)printf("-1\n");
else printf("%d\n",ans);
return 0;
}
184