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

Why wa #4, please give me some test
Posted by Najmaddin Akhundov 20 Nov 2014 07:33
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int n, a;
    cin >> n >> a;

    if (n == 1)
        cout << 0 << endl;
    else
    {
        int S = n - 1;
        //int S = n;
        for (int i = 1; i <= n; i++)
        {
            S = S - min(a, i);

            if (S <= 0)
            {
                cout << i << endl;
                break;
            }
        }
    }
}