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

Accepted wrong code?
Posted by lilica 20 Mar 2011 00:54
I submitted this code, and it was accepted, though if n=2 and k=5, the answer is 1, which is impossible

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

public class ch1 {
    public static void main(String args[]) throws ArithmeticException{
        Scanner in =new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        long N = in.nextLong();
        long K = in.nextLong();
            N=2*N;
            if(N==2) out.print(2);
            else if(N%K==0) out.print(N/K);
            else out.print(N/K+1);

        out.flush();
        in.close();
        out.close();
    }
}