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 1131. Copying

Bakhodir Boydedaev wrong ans #4.Is there any test. [2] // Problem 1131. Copying 5 Dec 2014 20:05
import java.util.Scanner;

/**
 * Created by Coder on 05.12.2014.
 */
public class Copy1131_ {
    public static void main(String[] args) {
        Scanner x = new Scanner(System.in);
        int n = x.nextInt();
        int k = x.nextInt();
        int time = 0, i = 1;
        long s = 1;
        while (s < n) {
            if (i >= k) {
                s += k;
            } else {
                s += i++;
            }
            time++;
        }
        System.out.println(time);
    }
}
বাঙালি Re: wrong ans #4.Is there any test. // Problem 1131. Copying 22 Oct 2015 17:44
TRY :
7 2
u should get:
4
বাঙালি Re: wrong ans #4.Is there any test. // Problem 1131. Copying 22 Oct 2015 17:44
TRY :
7 2
u should get:
4