結果
| 問題 | No.24 数当てゲーム |
| コンテスト | |
| ユーザー |
fujita
|
| 提出日時 | 2023-04-27 14:38:37 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 4,514 bytes |
| 記録 | |
| コンパイル時間 | 10,501 ms |
| コンパイル使用メモリ | 167,248 KB |
| 実行使用メモリ | 187,088 KB |
| 最終ジャッジ日時 | 2024-11-16 21:13:06 |
| 合計ジャッジ時間 | 11,812 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 8 WA * 2 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (93 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System.Collections.Generic;
using System;
using System.Linq;
using System.Drawing;
namespace yukicoder
{
class Program
{
static void Main(string[] args)
{
int N = int.Parse(Console.ReadLine());
int m = 0, x = 1;
var list = new List<string>() {"0", "1", "2", "3", "4", "5",
"6" , "7" , "8" , "9" ,};
var anslist = new List<string>();
var newanslist = new List<string>();
for (int i = 0; i < N; i++)
{
var a = Console.ReadLine();
var A = a.Split();
if (a.Contains("YES"))
{
anslist.Add(A[0]);
anslist.Add(A[1]);
anslist.Add(A[2]);
anslist.Add(A[3]);
anslist.Sort();
}
else if (a.Contains("NO"))
{
list.Remove(A[0]);
list.Remove(A[1]);
list.Remove(A[2]);
list.Remove(A[3]);
}
}
//新しいリストにanslistで重複している数字を入れる
for(int j = 0; j < anslist.Count - 1; j++)
{
if (anslist[j] == anslist[x])
{
x++;
newanslist.Add(anslist[j]);
}
else
{
x++;
continue;
}
}
//listの要素が1つかnewanslistの要素が1つか
if(list.Count == 1 || newanslist.Count == 1)
{
if(list.Count == 1)
{
Console.WriteLine(list[0]);
}
else
{
Console.WriteLine(newanslist[0]);
}
}else if (list.Count > 1 && newanslist.Count > 1)
{//listの要素が1つ以上かnewanslistの要素が1つ以上か
if (newanslist.Count > list.Count || !(anslist.Count < 1))
{
for (int i = 0; i < list.Count; i++)
{
for(int j = 0; j < newanslist.Count; j++)
{
if (list[i].Equals(newanslist[j]))
{
for(m = 0; m < newanslist.Count - 1; m++)
{
if (newanslist[m].Equals(newanslist[m + 1]))
{
Console.WriteLine(newanslist[m]);
break;
}
}
}
if (!(m == 0))
{
break;
}
}
if (!(m == 0))
{
break;
}
}
}
}
else if (list.Count > 1 && newanslist.Count > 1 && anslist.Count > 1)
{
for (int i = 0; i < list.Count; i++)
{
for (int j = 0; j < newanslist.Count; j++)
{
for(int k = 0; k < anslist.Count; k++)
{
if (list[i].Equals(newanslist[j]) && list[i].Equals(anslist[j]))
{
Console.WriteLine(list[i]);
break;
}
}
}
}
}
else if (newanslist.Count == 0 )
{
for (int i = 0; i < list.Count; i++)
{
for (int j = 0; j < anslist.Count; j++)
{
if (list[i].Equals(anslist[j]))
{
Console.WriteLine(list[i]);
break;
}
}
}
}
}
}
}
fujita