結果
問題 | No.2259 Gas Station |
ユーザー |
![]() |
提出日時 | 2023-04-08 11:20:25 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 733 bytes |
コンパイル時間 | 962 ms |
コンパイル使用メモリ | 112,940 KB |
実行使用メモリ | 18,048 KB |
最終ジャッジ日時 | 2024-10-03 06:44:23 |
合計ジャッジ時間 | 2,312 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
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{static void Main(){string[] line = Console.ReadLine().Trim().Split(' ');var L = long.Parse(line[0]);var r = long.Parse(line[1]);var c = long.Parse(line[2]);getAns(L, r, c);}static void getAns(long L, long r, long c){if (c % 1000 == 0) { Console.WriteLine(0); return; }c %= 1000;r = Min(r, L + 1000);var ans = long.MaxValue;for (long i = L; i <= r; i++){var t = 1000 - (c * i) % 1000;if (t == 0 | t == 1000) { Console.WriteLine(0); return; }ans = Min(ans, t);}Console.WriteLine(ans);}}