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

wtf WA TEST#8 PLS HELP ANYONE
Posted by Akash_Cross 1 Aug 2015 21:14
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

//URAL STEAKS
public class P {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        String line;
        int ans;
        line = br.readLine().trim();
        String str[];
        str = line.split(" ");
        int N = Integer.parseInt(str[0]);
        int K = Integer.parseInt(str[1]);
        if(2*N%K>1){
            ans = (2*N/K)+1;
        }else{
            ans = (2*N/K);
        }
        out.print(ans);
        out.flush();
    }
}
Re: wtf WA TEST#8 PLS HELP ANYONE
Posted by Ivan Avdonin (Vologda ML) 4 Aug 2015 03:03
При N = 1, K = 2 программа выдаёт 1, а должна 2 по условию задачи.
Re: wtf WA TEST#8 PLS HELP ANYONE
Posted by akash_cross 4 Aug 2015 21:21
Please give answer in English...
Re: wtf WA TEST#8 PLS HELP ANYONE
Posted by Zhaltsanov I 23 Sep 2015 13:49
if (n<=k) the answer is 2
Re: wtf WA TEST#8 PLS HELP ANYONE
Posted by JO 24 Sep 2015 22:49
(2*N)%K
not 2*N%K