結果
| 問題 | No.239 にゃんぱすー |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-28 17:52:34 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 30 ms / 2,000 ms |
| コード長 | 1,065 bytes |
| コンパイル時間 | 4,075 ms |
| コンパイル使用メモリ | 110,252 KB |
| 実行使用メモリ | 26,716 KB |
| 最終ジャッジ日時 | 2025-11-28 17:52:41 |
| 合計ジャッジ時間 | 3,655 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
class Program
{
static void Main(string[] args)
{
int total = int.Parse(Console.ReadLine()!);
string[,] wordArray = new string[total, total];
for (int i = 0; i < total; i++)
{
string[] input = Console.ReadLine()!.Split(' ');
for (int j = 0; j < input.Length; j++)
{
wordArray[i, j] = input[j];
}
}
int ans = 0;
int count = 0;
for (int i = 0;i < total; i++)
{
int wordCount = 0;
for (int j = 0; j < total; j++)
{
if (wordArray[j, i] == "nyanpass" || wordArray[j, i] == "-")
{
wordCount++;
}
}
if (wordCount == total)
{
count++;
ans = i + 1;
}
}
if (count == 1 && ans != 0)
{
Console.WriteLine(ans);
}
else
{
Console.WriteLine(-1);
}
}
}