結果
| 問題 |
No.933 おまわりさんこいつです
|
| コンテスト | |
| ユーザー |
Maeda
|
| 提出日時 | 2025-04-01 17:32:44 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,186 bytes |
| コンパイル時間 | 7,803 ms |
| コンパイル使用メモリ | 169,804 KB |
| 実行使用メモリ | 214,416 KB |
| 最終ジャッジ日時 | 2025-04-01 17:32:58 |
| 合計ジャッジ時間 | 13,133 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 RE * 15 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (114 ミリ秒)。 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());
string num = Console.ReadLine();
string[] numList = num.Split(' ');
decimal sum = 1;
if (numList.Length > 1)
{
for (int i = 0; i < n; i++)
{
if (decimal.Parse(numList[i]) % 9 == 0)
{
sum *= 9;
continue;
}
sum *= decimal.Parse(numList[i]) % 9;
}
}
else
{
sum = decimal.Parse(num);
}
Console.WriteLine(NumericRoot(sum.ToString()));
}
private static int NumericRoot(string sum)
{
string str = sum;
while (str.Length > 1){
int num = 0;
for(int i = 0; i < str.Length; i++)
{
num += int.Parse(str[i].ToString());
}
str = num.ToString();
}
return int.Parse(str);
}
}
Maeda