結果

問題 No.1350 2019-6problem
ユーザー さかぽんさかぽん
提出日時 2021-01-17 13:40:33
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 652 bytes
コンパイル時間 901 ms
コンパイル使用メモリ 113,812 KB
実行使用メモリ 26,132 KB
最終ジャッジ日時 2024-05-07 02:21:54
合計ジャッジ時間 2,420 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
26,132 KB
testcase_01 AC 26 ms
23,888 KB
testcase_02 AC 27 ms
23,840 KB
testcase_03 AC 26 ms
23,980 KB
testcase_04 AC 26 ms
23,980 KB
testcase_05 AC 26 ms
21,684 KB
testcase_06 AC 26 ms
23,956 KB
testcase_07 AC 26 ms
25,784 KB
testcase_08 AC 26 ms
23,876 KB
testcase_09 AC 26 ms
21,936 KB
testcase_10 AC 26 ms
25,920 KB
testcase_11 AC 26 ms
23,580 KB
testcase_12 AC 26 ms
25,920 KB
testcase_13 AC 26 ms
24,116 KB
testcase_14 AC 27 ms
24,092 KB
testcase_15 AC 27 ms
25,924 KB
testcase_16 AC 26 ms
23,964 KB
testcase_17 AC 27 ms
26,132 KB
testcase_18 AC 26 ms
23,880 KB
testcase_19 AC 28 ms
23,968 KB
testcase_20 AC 26 ms
23,616 KB
testcase_21 AC 26 ms
24,004 KB
testcase_22 AC 27 ms
25,792 KB
testcase_23 AC 26 ms
23,748 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