結果
問題 | No.239 にゃんぱすー |
ユーザー |
![]() |
提出日時 | 2016-12-11 18:05:36 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 239 ms / 2,000 ms |
コード長 | 1,036 bytes |
コンパイル時間 | 2,277 ms |
コンパイル使用メモリ | 74,428 KB |
実行使用メモリ | 58,136 KB |
最終ジャッジ日時 | 2024-11-29 03:34:36 |
合計ジャッジ時間 | 10,439 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int people = sc.nextInt();String[][] greetings = new String[people][people];for (int i = 0; i < people; i++) {for (int j = 0; j < people; j++) {greetings[i][j] = sc.next();}}int[] rengeCount = new int[people];for (int i = 0; i < people; i++) {for (int j = 0; j < people; j++) {if (greetings[i][j].equals("nyanpass")) {rengeCount[j]++;}}}int renge = -1;for (int i = 0; i < people; i++) {if (rengeCount[i] == people - 1) {if (renge == -1) {renge = i + 1;} else {renge = -1;break;}}}System.out.println(renge);}}