結果

問題 No.1350 2019-6problem
ユーザー さかぽんさかぽん
提出日時 2021-01-17 13:40:33
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 652 bytes
コンパイル時間 4,926 ms
コンパイル使用メモリ 102,032 KB
実行使用メモリ 24,804 KB
最終ジャッジ日時 2023-08-19 19:26:34
合計ジャッジ時間 4,390 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
20,744 KB
testcase_01 AC 54 ms
22,948 KB
testcase_02 AC 55 ms
20,832 KB
testcase_03 AC 55 ms
20,764 KB
testcase_04 AC 55 ms
20,752 KB
testcase_05 AC 54 ms
20,896 KB
testcase_06 AC 56 ms
20,828 KB
testcase_07 AC 56 ms
22,808 KB
testcase_08 AC 55 ms
20,888 KB
testcase_09 AC 54 ms
18,800 KB
testcase_10 AC 54 ms
20,760 KB
testcase_11 AC 55 ms
20,884 KB
testcase_12 AC 54 ms
20,912 KB
testcase_13 AC 55 ms
20,836 KB
testcase_14 AC 55 ms
22,732 KB
testcase_15 AC 55 ms
22,748 KB
testcase_16 AC 54 ms
22,904 KB
testcase_17 AC 54 ms
20,764 KB
testcase_18 AC 55 ms
22,860 KB
testcase_19 AC 56 ms
20,692 KB
testcase_20 AC 56 ms
24,804 KB
testcase_21 AC 54 ms
20,760 KB
testcase_22 AC 54 ms
20,748 KB
testcase_23 AC 55 ms
20,740 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 A
{
	static long[] ReadL() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
	static (long, long, long) Read3L() { var a = ReadL(); return (a[0], a[1], a[2]); }
	static void Main()
	{
		var (a, b, k) = Read3L();
		var lcm = Lcm(a, b);
		Console.WriteLine(First(1, 1L << 60, x => x / a + x / b - x / lcm >= k));
	}

	static long Gcd(long a, long b) { for (long r; (r = a % b) > 0; a = b, b = r) ; return b; }
	static long Lcm(long a, long b) => a / Gcd(a, b) * b;

	static long First(long l, long r, Func<long, bool> f)
	{
		long m;
		while (l < r) if (f(m = l + (r - l - 1) / 2)) r = m; else l = m + 1;
		return r;
	}
}
0