結果
問題 | No.239 にゃんぱすー |
ユーザー |
|
提出日時 | 2018-03-17 19:30:42 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 726 bytes |
コンパイル時間 | 315 ms |
コンパイル使用メモリ | 44,388 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 00:31:13 |
合計ジャッジ時間 | 1,400 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%d",&N); | ~~~~~^~~~~~~~~ main.cpp:15:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%s",str); | ~~~~~^~~~~~~~~~
ソースコード
#include <stdio.h>#include <string>int main(){//inputint N;scanf("%d",&N);bool person[100];for (int i = 0;i < N;i++){person[i] = true;}for (int i = 0;i < N;i++){for (int j = 0;j < N;j++){char str[31];scanf("%s",str);if (i != j && std::string(str) != "nyanpass"){person[j] = false;}}}//count "true" personint renge;int count = 0;for (int i = 0;i < N;i++){if (person[i]){renge = i+1;count++;}}//outputif (count == 1){printf("%d\n",renge);}else{printf("%d\n",-1);}return 0;}