結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
23,076 KB
testcase_01 AC 73 ms
24,988 KB
testcase_02 AC 87 ms
23,116 KB
testcase_03 AC 80 ms
27,128 KB
testcase_04 AC 83 ms
25,048 KB
testcase_05 AC 81 ms
25,316 KB
testcase_06 AC 81 ms
26,444 KB
testcase_07 AC 59 ms
22,696 KB
testcase_08 AC 80 ms
28,920 KB
testcase_09 AC 90 ms
27,184 KB
testcase_10 AC 77 ms
27,448 KB
testcase_11 AC 86 ms
25,136 KB
testcase_12 AC 59 ms
20,624 KB
testcase_13 AC 85 ms
25,128 KB
testcase_14 AC 79 ms
26,580 KB
testcase_15 AC 83 ms
25,200 KB
testcase_16 AC 59 ms
22,740 KB
testcase_17 AC 81 ms
24,976 KB
testcase_18 AC 78 ms
25,280 KB
testcase_19 AC 58 ms
22,676 KB
testcase_20 AC 59 ms
20,704 KB
testcase_21 AC 85 ms
27,844 KB
testcase_22 AC 58 ms
20,708 KB
testcase_23 AC 58 ms
20,712 KB
testcase_24 AC 78 ms
26,952 KB
testcase_25 AC 57 ms
20,724 KB
testcase_26 AC 58 ms
20,716 KB
testcase_27 AC 74 ms
24,928 KB
testcase_28 AC 81 ms
26,720 KB
testcase_29 AC 73 ms
24,944 KB
testcase_30 AC 92 ms
28,836 KB
testcase_31 AC 80 ms
26,928 KB
testcase_32 AC 97 ms
30,844 KB
testcase_33 AC 58 ms
20,792 KB
testcase_34 AC 72 ms
24,904 KB
testcase_35 AC 72 ms
24,924 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 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] + 5000000];
		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