結果

問題 No.281 門松と魔法(1)
ユーザー fal_rndfal_rnd
提出日時 2016-10-30 01:14:14
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 471 bytes
コンパイル時間 4,844 ms
コンパイル使用メモリ 71,984 KB
実行使用メモリ 57,696 KB
最終ジャッジ日時 2023-08-16 11:10:25
合計ジャッジ時間 12,928 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,760 KB
testcase_01 AC 125 ms
55,640 KB
testcase_02 WA -
testcase_03 AC 125 ms
56,088 KB
testcase_04 AC 125 ms
55,932 KB
testcase_05 AC 123 ms
56,000 KB
testcase_06 AC 125 ms
55,744 KB
testcase_07 AC 124 ms
55,696 KB
testcase_08 AC 125 ms
55,816 KB
testcase_09 AC 124 ms
55,936 KB
testcase_10 AC 125 ms
55,668 KB
testcase_11 AC 123 ms
56,048 KB
testcase_12 AC 125 ms
55,916 KB
testcase_13 AC 126 ms
55,724 KB
testcase_14 AC 124 ms
56,060 KB
testcase_15 AC 122 ms
55,724 KB
testcase_16 AC 120 ms
55,672 KB
testcase_17 AC 122 ms
55,736 KB
testcase_18 AC 123 ms
55,636 KB
testcase_19 AC 126 ms
55,856 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 118 ms
55,664 KB
testcase_23 AC 122 ms
55,856 KB
testcase_24 AC 121 ms
56,236 KB
testcase_25 WA -
testcase_26 AC 124 ms
55,468 KB
testcase_27 AC 122 ms
55,676 KB
testcase_28 AC 121 ms
55,728 KB
testcase_29 AC 121 ms
55,432 KB
testcase_30 WA -
testcase_31 AC 121 ms
55,436 KB
testcase_32 AC 121 ms
55,812 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 123 ms
56,016 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 123 ms
55,592 KB
testcase_47 AC 122 ms
55,896 KB
testcase_48 AC 121 ms
55,808 KB
testcase_49 AC 122 ms
55,708 KB
testcase_50 AC 122 ms
56,060 KB
testcase_51 WA -
testcase_52 AC 123 ms
55,768 KB
testcase_53 AC 126 ms
55,808 KB
testcase_54 WA -
testcase_55 AC 122 ms
55,528 KB
testcase_56 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
class C{
	static Scanner s=new Scanner(System.in);
	static long d,l,c,r;
	public static void main(String[] args){
		d=s.nextLong();
		l=s.nextLong();
		c=s.nextLong();
		r=s.nextLong();
		if(d==0&&!kadomatsued()){
			System.out.println(-1);
		}else if(kadomatsued()){
			System.out.println(0);
		}else{
			System.out.println(Math.min(Math.abs(l-c), Math.abs(r-c))/d+1);
		}
	}
	static boolean kadomatsued(){
		return (c>l&&c>r)||(c<l&&c<r);
	}
}
0