結果
| 問題 | No.432 占い(Easy) |
| コンテスト | |
| ユーザー |
Maeda
|
| 提出日時 | 2025-04-08 13:15:05 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,709 bytes |
| コンパイル時間 | 7,618 ms |
| コンパイル使用メモリ | 170,548 KB |
| 実行使用メモリ | 188,748 KB |
| 最終ジャッジ日時 | 2025-04-08 13:15:17 |
| 合計ジャッジ時間 | 10,645 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 WA * 3 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (109 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
class Program
{
static void Main(string[] args)
{
int n = int.Parse(Console.ReadLine());
int[] ansList = Enumerable.Repeat(-1, n).ToArray();
for (int i = 0; i < n; i++)
{
string str = Console.ReadLine();
if (str.Length > 2)
{
List<int> list = new List<int>();
for (int j = 0; j < str.Length; j++)
{
list.Add(int.Parse(str[j].ToString()));
}
ansList[i] = RecursionNumber(list, ansList[i]);
}
else
{
ansList[i] = int.Parse(str)/10 + int.Parse(str) % 10;
}
}
for(int i = 0; i < n; i++)
{
Console.WriteLine(ansList[i]);
}
}
private static int RecursionNumber(List<int> list,int ans)
{
List<int> newList = new List<int>();
for (int i = 1; i < list.Count; i++)
{
int num = list[i - 1] + list[i];
if(num >= 10)
{
num = (num / 10) + (num % 10);
}
newList.Add(num);
}
if (newList.Count > 2)
{
ans = RecursionNumber(newList, ans);
}
else
{
ans = newList[0] + newList[1];
if (ans >= 10)
{
ans = (ans / 10) + (ans % 10);
}
}
return ans;
}
}
Maeda