|
|
back to boardI Receiving the right unswer, but JUDGE doesn't think so Here is the code: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s = scan.nextLine(); String str[] = s.split(" "); int n = Integer.parseInt(str[0]), k = Integer.parseInt(str[1]); double res; res = (double) (2*n)%k; res /= k; if (res < 0.5){ n = 2*n/k; } else{ n = (2*n/k)+1;} System.out.println(Integer.toString(n)); } } =========================Test 3 2 (3) 4 3 (3) 7 3 (5) |
|
|