|
|
вернуться в форумwtf WA TEST#8 PLS HELP ANYONE 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 При N = 1, K = 2 программа выдаёт 1, а должна 2 по условию задачи. Re: wtf WA TEST#8 PLS HELP ANYONE Please give answer in English... Re: wtf WA TEST#8 PLS HELP ANYONE if (n<=k) the answer is 2 Re: wtf WA TEST#8 PLS HELP ANYONE Послано JO 24 сен 2015 22:49 (2*N)%K not 2*N%K |
|
|