結果

問題 No.239 にゃんぱすー
ユーザー tenkyu9
提出日時 2018-01-20 02:57:57
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 666 bytes
コンパイル時間 833 ms
コンパイル使用メモリ 69,896 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 13:00:35
合計ジャッジ時間 2,233 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<cstring>
using namespace std;
 
int main(){

  int n, nyan[100]={0}, ppoi=0, num;
  string a[100][100];
  cin >> n;
  for(int i=0; i<n; i++){
    for(int j=0; j<n; j++){
      cin >> a[i][j];
      if(a[i][j]=="nyanpass"){
        nyan[j]++;
      }
    }
  }

  for(int i=0; i<n; i++){
    if(nyan[i]==n-1){
      ppoi++;
      if(ppoi==1){
        num=i+1;
      } else {
        cout << -1 << endl;
        return 0;
      }
    }
  }

  if(ppoi==0){
    cout << -1 << endl;
  } else {
    cout << num << endl;
  }

  return 0;
}
0