結果

問題 No.2259 Gas Station
ユーザー kusagame12kusagame12
提出日時 2023-11-22 16:09:24
言語 Java21
(openjdk 21)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 705 bytes
コンパイル時間 1,912 ms
コンパイル使用メモリ 73,976 KB
実行使用メモリ 57,972 KB
最終ジャッジ日時 2023-11-22 16:09:31
合計ジャッジ時間 6,465 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
56,684 KB
testcase_01 AC 121 ms
57,728 KB
testcase_02 AC 119 ms
57,696 KB
testcase_03 AC 122 ms
57,832 KB
testcase_04 AC 123 ms
57,812 KB
testcase_05 AC 109 ms
56,688 KB
testcase_06 AC 120 ms
57,840 KB
testcase_07 AC 120 ms
57,544 KB
testcase_08 AC 123 ms
57,844 KB
testcase_09 AC 122 ms
56,668 KB
testcase_10 AC 121 ms
57,844 KB
testcase_11 AC 122 ms
57,824 KB
testcase_12 AC 110 ms
56,680 KB
testcase_13 AC 121 ms
57,828 KB
testcase_14 AC 110 ms
56,784 KB
testcase_15 AC 111 ms
56,684 KB
testcase_16 AC 130 ms
56,684 KB
testcase_17 AC 120 ms
57,576 KB
testcase_18 AC 121 ms
57,832 KB
testcase_19 AC 122 ms
57,944 KB
testcase_20 AC 122 ms
57,844 KB
testcase_21 AC 118 ms
55,748 KB
testcase_22 AC 122 ms
57,972 KB
testcase_23 AC 112 ms
56,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    
    static int[] dy = {0,1,0,1};
    static int[] dx = {1,0,1,0};
    
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        
        int l = sc.nextInt();
        int r = sc.nextInt();
        int c = sc.nextInt();

        int ans = 999;
        for(int i = l ; i <= r ; i++){
            
            int x = ((i % 1000) * (c % 1000)) % 1000;
            
            if(x == 0){
                ans = 0;
                break;
            }
            
            ans = Math.min(ans , 1000 - x);
            
        }
        
        System.out.println(ans);
        
    }
    
}
0