結果
| 問題 | No.2 素因数ゲーム |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-18 15:03:34 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,577 bytes |
| 記録 | |
| コンパイル時間 | 2,621 ms |
| コンパイル使用メモリ | 112,920 KB |
| 実行使用メモリ | 58,392 KB |
| 最終ジャッジ日時 | 2024-07-06 03:30:06 |
| 合計ジャッジ時間 | 8,171 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 6 TLE * 1 -- * 24 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
namespace No002_素因数ゲーム
{
class Program
{
static void Main(string[] args)
{
int n = int.Parse(Console.ReadLine());
int[] counter = Factoring(n);
int sumA = 0;
int sumB = 0;
foreach (int a in counter)
{
if (a == 1)
sumA++;
if (a > 1)
sumB++;
}
foreach (int a in counter)
Console.Write(a.ToString() + ", ");
Console.WriteLine();
Console.WriteLine();
Console.WriteLine();
if (sumA + sumB == 3)
Console.WriteLine("Alice");
else if (sumA % 2 == 1)
Console.WriteLine("Alice");
else if (sumA + sumB == 3)
Console.WriteLine("Alice");
else if (sumB % 2 == 1)
Console.WriteLine("Alice");
else
Console.WriteLine("Bob");
}
static int[] Factoring(int n)
{
int max = (n + n % 2) / 2;
int[] number = new int[max];
int[] counter = new int[max];
number[0] = 2;
for (int i = 3; i <= n; i += 2)
number[i / 2] = i;
for (int i = 0; i < max; i++)
{
while (n % number[i] == 0)
{
n /= number[i];
counter[i]++;
}
}
return counter;
}
}
}