結果

問題 No.1352 Three Coins
ユーザー さかぽんさかぽん
提出日時 2021-01-23 22:41:27
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 793 bytes
コンパイル時間 2,293 ms
コンパイル使用メモリ 102,956 KB
実行使用メモリ 26,100 KB
最終ジャッジ日時 2023-08-30 07:33:31
合計ジャッジ時間 6,452 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
22,956 KB
testcase_01 AC 60 ms
20,816 KB
testcase_02 AC 60 ms
22,796 KB
testcase_03 AC 59 ms
20,928 KB
testcase_04 AC 60 ms
22,920 KB
testcase_05 AC 61 ms
20,896 KB
testcase_06 AC 65 ms
22,324 KB
testcase_07 AC 58 ms
20,704 KB
testcase_08 AC 63 ms
20,180 KB
testcase_09 AC 60 ms
20,864 KB
testcase_10 AC 61 ms
22,784 KB
testcase_11 AC 60 ms
18,768 KB
testcase_12 AC 58 ms
22,680 KB
testcase_13 AC 64 ms
21,088 KB
testcase_14 AC 64 ms
21,992 KB
testcase_15 AC 62 ms
20,880 KB
testcase_16 AC 59 ms
20,860 KB
testcase_17 AC 60 ms
18,788 KB
testcase_18 AC 62 ms
20,840 KB
testcase_19 AC 59 ms
20,792 KB
testcase_20 AC 58 ms
22,752 KB
testcase_21 AC 66 ms
22,844 KB
testcase_22 AC 58 ms
20,860 KB
testcase_23 AC 58 ms
20,924 KB
testcase_24 AC 61 ms
20,740 KB
testcase_25 AC 59 ms
22,912 KB
testcase_26 AC 59 ms
20,804 KB
testcase_27 AC 61 ms
22,816 KB
testcase_28 AC 68 ms
25,884 KB
testcase_29 AC 60 ms
18,836 KB
testcase_30 AC 71 ms
26,100 KB
testcase_31 AC 61 ms
20,900 KB
testcase_32 AC 72 ms
24,120 KB
testcase_33 AC 58 ms
22,868 KB
testcase_34 AC 58 ms
20,736 KB
testcase_35 AC 59 ms
20,780 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

class C
{
	static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
	static void Main() => Console.WriteLine(Solve());
	static object Solve()
	{
		var a = Read();
		Array.Sort(a);

		if (Gcd(Gcd(a[0], a[1]), a[2]) > 1) return "INF";
		if (Gcd(a[0], a[1]) > 1) (a[1], a[2]) = (a[2], a[1]);
		if (Gcd(a[0], a[1]) > 1) (a[0], a[2]) = (a[2], a[0]);

		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;

		var r = 0;
		for (int k = 1; k < a[2]; k++)
			for (int i = k; i < u.Length && !u[i]; i += a[2])
				r++;
		return r;
	}

	static int Gcd(int a, int b) { for (int r; (r = a % b) > 0; a = b, b = r) ; return b; }
}
0