結果
| 問題 |
No.1350 2019-6problem
|
| コンテスト | |
| ユーザー |
bluemegane
|
| 提出日時 | 2021-05-18 20:13:55 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 776 bytes |
| コンパイル時間 | 1,894 ms |
| コンパイル使用メモリ | 103,808 KB |
| 実行使用メモリ | 17,920 KB |
| 最終ジャッジ日時 | 2024-10-08 22:47:31 |
| 合計ジャッジ時間 | 2,525 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 WA * 5 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using static System.Math;
using System;
public class Hello
{
public static long a, b, k;
static void Main()
{
string[] line = Console.ReadLine().Trim().Split(' ');
a = long.Parse(line[0]);
b = long.Parse(line[1]);
k = long.Parse(line[2]);
getAns();
}
static bool check(long t) => t / a + t / b - t / a / b >= k;
static void getAns()
{
if (k == 1) { Console.WriteLine(Min(a, b)); return; }
if (k == 2) { Console.WriteLine(Max(a, b)); return; }
var ok = long.MaxValue;
var ng = 1L;
while (ok - ng > 1)
{
var mid = ng + (ok - ng) / 2L;
if (check(mid)) ok = mid;
else ng = mid;
}
Console.WriteLine(ok);
}
}
bluemegane