結果
| 問題 |
No.1352 Three Coins
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-17 14:54:58 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 910 bytes |
| コンパイル時間 | 928 ms |
| コンパイル使用メモリ | 112,540 KB |
| 実行使用メモリ | 36,224 KB |
| 最終ジャッジ日時 | 2024-11-29 20:19:14 |
| 合計ジャッジ時間 | 34,119 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 WA * 3 TLE * 8 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Linq;
class C
{
static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
static long[] ReadL() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
static void Main() => Console.WriteLine(Solve());
static object Solve()
{
var a = Read();
Array.Sort(a);
//if (a.Any(x => x == 1)) return 0;
if (Gcd(Gcd(a[0], a[1]), a[2]) > 1) return "INF";
var u = new bool[a[0] * a[1]];
for (int k = 0; k < a[0]; k++)
for (int i = k * a[1]; i < u.Length; i += a[0])
u[i] = true;
for (int i = 0; i < u.Length; i += a[2])
u[i] = true;
for (int i = a[0]; i < u.Length; i++)
{
if (u[i]) continue;
for (int j = 1; j < i; j++)
{
if (u[j] && u[i - j])
{
u[i] = true;
break;
}
}
}
return u.Count(x => !x);
}
static int Gcd(int a, int b) { for (int r; (r = a % b) > 0; a = b, b = r) ; return b; }
}