結果

問題 No.512 魔法少女の追いかけっこ
ユーザー tsunabit
提出日時 2019-06-13 01:33:54
言語 Java
(openjdk 23)
結果
AC  
実行時間 158 ms / 2,000 ms
コード長 753 bytes
コンパイル時間 3,289 ms
コンパイル使用メモリ 74,468 KB
実行使用メモリ 42,112 KB
最終ジャッジ日時 2024-10-12 05:47:50
合計ジャッジ時間 12,608 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 53
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

public class No512 {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	double x = sc.nextDouble() * 1000 / 3600, y = sc.nextDouble() * 1000 / 3600;
    	int n = sc.nextInt();
    	int[] a = new int[n];
    	
    	for(int i = 0; i < n; i++) {
    		a[i] = sc.nextInt();
    	}
    	for(int i = 0; i < n - 1; i++) {
    		double j = a[i] / x;
//    		System.out.println("i = " + (i + 1) + " a[i + 1] = " + a[i + 1] + ": j * y = " + (int)(j * y));
    		// y * a[i] * x > a[i + 1] → y * a[i] > a[i + 1] * x
    		if((int)(y * a[i]) > a[i + 1] * x) {
    			System.out.println("NO");
    			return;
    		}
    	}
    	System.out.println("YES");
    }
}
0