結果

問題 No.1352 Three Coins
ユーザー さかぽんさかぽん
提出日時 2021-01-23 23:47:02
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 748 bytes
コンパイル時間 5,149 ms
コンパイル使用メモリ 105,432 KB
実行使用メモリ 27,076 KB
最終ジャッジ日時 2023-08-30 09:36:55
合計ジャッジ時間 10,630 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
23,460 KB
testcase_01 AC 59 ms
23,444 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 56 ms
21,504 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 57 ms
21,420 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 57 ms
21,440 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 57 ms
21,500 KB
testcase_20 AC 56 ms
21,624 KB
testcase_21 WA -
testcase_22 AC 56 ms
21,584 KB
testcase_23 AC 56 ms
23,496 KB
testcase_24 WA -
testcase_25 AC 56 ms
21,460 KB
testcase_26 AC 55 ms
21,476 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 139 ms
24,756 KB
testcase_31 AC 64 ms
21,496 KB
testcase_32 AC 139 ms
24,712 KB
testcase_33 AC 57 ms
23,500 KB
testcase_34 AC 59 ms
21,388 KB
testcase_35 AC 60 ms
23,516 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;

class C2
{
	static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
	static void Main() => Console.WriteLine(Solve());
	static object Solve()
	{
		var v = Read();
		var (a, b, c) = (v[0], v[1], v[2]);

		if (Gcd(Gcd(a, b), c) > 1) return "INF";
		var m = v.Max();

		var u = new bool[m * m];
		for (int k = 0; k < a; k++)
			for (int i = k * b; i < u.Length; i += a)
				u[i] = true;
		for (int k = 0; k < a; k++)
			for (int i = k * c; i < u.Length; i += a)
				u[i] = true;
		for (int k = 0; k < b; k++)
			for (int i = k * c; i < u.Length; i += b)
				u[i] = true;
		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; }
}
0