結果

問題 No.239 にゃんぱすー
ユーザー 37kt_
提出日時 2015-09-03 18:20:45
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 400 bytes
コンパイル時間 1,139 ms
コンパイル使用メモリ 159,496 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-18 21:53:32
合計ジャッジ時間 2,109 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
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);
      |         ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

string t = "nyanpass";
int n;
int cnt[100];

int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			string s;
			cin >> s;
			if (s == t) cnt[j]++;
		}
	}
	
	int q = 0, r = -1;
	for (int i = 0; i < n; i++){
		if (cnt[i] == n - 1){
			q++;
			r = i;
		}
	}
	
	if (q != 1) puts("-1");
	else printf("%d\n", r + 1);
}
0