結果
| 問題 | No.24 数当てゲーム |
| コンテスト | |
| ユーザー |
fujita
|
| 提出日時 | 2023-04-27 15:32:57 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
AC
|
| 実行時間 | 52 ms / 5,000 ms |
| コード長 | 4,971 bytes |
| コンパイル時間 | 6,639 ms |
| コンパイル使用メモリ | 167,592 KB |
| 実行使用メモリ | 185,256 KB |
| 最終ジャッジ日時 | 2024-11-16 21:41:10 |
| 合計ジャッジ時間 | 7,700 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (88 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) /home/judge/data/code/Main.cs(19,18): warning CS0168: 変数 'g' は宣言されていますが、使用されていません [/home/judge/data/code/main.csproj] 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, z = 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>();
bool g;
bool boolean = false;
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;
}
}
//newanslistの重複判別
for (int j = 0; j < newanslist.Count - 1; j++)
{
if (newanslist[j] == newanslist[z])
{
boolean = true;
z++;
}
else
{
z++;
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 (boolean == true)
{
for (int j = 0; j < newanslist.Count; 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;
}
}
}
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 zz = 0; zz < newanslist.Count - 1;zz++)
{
if (list[i].Equals(newanslist[zz]))
{
Console.WriteLine(list[i]);
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