結果
問題 | No.2259 Gas Station |
ユーザー |
|
提出日時 | 2023-11-22 16:09:24 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 124 ms / 2,000 ms |
コード長 | 705 bytes |
コンパイル時間 | 2,306 ms |
コンパイル使用メモリ | 74,256 KB |
実行使用メモリ | 41,668 KB |
最終ジャッジ日時 | 2024-09-26 07:34:37 |
合計ジャッジ時間 | 5,990 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
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);}}