結果
問題 |
No.281 門松と魔法(1)
|
ユーザー |
![]() |
提出日時 | 2016-10-30 01:14:14 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 471 bytes |
コンパイル時間 | 2,327 ms |
コンパイル使用メモリ | 74,604 KB |
実行使用メモリ | 54,540 KB |
最終ジャッジ日時 | 2024-11-24 23:28:02 |
合計ジャッジ時間 | 11,576 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 37 WA * 20 |
ソースコード
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); } }