結果

問題 No.1352 Three Coins
ユーザー さかぽんさかぽん
提出日時 2021-01-23 23:02:22
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 706 bytes
コンパイル時間 2,730 ms
コンパイル使用メモリ 107,324 KB
実行使用メモリ 25,996 KB
最終ジャッジ日時 2023-08-30 08:24:43
合計ジャッジ時間 7,090 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
22,744 KB
testcase_01 AC 59 ms
20,704 KB
testcase_02 AC 59 ms
20,628 KB
testcase_03 AC 60 ms
20,632 KB
testcase_04 AC 61 ms
22,748 KB
testcase_05 AC 61 ms
20,704 KB
testcase_06 AC 65 ms
22,464 KB
testcase_07 AC 58 ms
20,716 KB
testcase_08 AC 64 ms
22,288 KB
testcase_09 AC 61 ms
22,756 KB
testcase_10 AC 61 ms
20,852 KB
testcase_11 AC 61 ms
20,656 KB
testcase_12 AC 59 ms
22,688 KB
testcase_13 AC 61 ms
23,116 KB
testcase_14 AC 63 ms
23,776 KB
testcase_15 AC 61 ms
20,804 KB
testcase_16 AC 58 ms
20,712 KB
testcase_17 AC 59 ms
20,632 KB
testcase_18 AC 61 ms
20,648 KB
testcase_19 AC 60 ms
20,848 KB
testcase_20 AC 59 ms
20,636 KB
testcase_21 AC 65 ms
24,928 KB
testcase_22 AC 59 ms
20,764 KB
testcase_23 AC 58 ms
20,728 KB
testcase_24 AC 60 ms
20,712 KB
testcase_25 AC 59 ms
20,780 KB
testcase_26 AC 58 ms
18,672 KB
testcase_27 AC 60 ms
22,752 KB
testcase_28 AC 67 ms
23,668 KB
testcase_29 AC 59 ms
20,628 KB
testcase_30 AC 68 ms
25,996 KB
testcase_31 AC 60 ms
22,752 KB
testcase_32 AC 70 ms
24,160 KB
testcase_33 AC 59 ms
22,692 KB
testcase_34 AC 60 ms
20,556 KB
testcase_35 AC 59 ms
20,704 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 v = Read();
		Array.Sort(v);
		var (a, b, c) = (v[0], v[1], v[2]);

		if (Gcd(Gcd(a, b), c) > 1) return "INF";
		if (Gcd(a, b) > 1) (b, c) = (c, b);
		if (Gcd(a, b) > 1) (a, c) = (c, a);

		var u = new bool[a * b];
		for (int k = 0; k < a; k++)
			for (int i = k * b; i < u.Length; i += a)
				u[i] = true;

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

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