ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1820. Ural Steaks

I Receiving the right unswer, but JUDGE doesn't think so
Posted by EvgeniyGusarov 4 Aug 2011 20:10
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)