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 1725. Sold Out!

Chukharev WR6 TEST [1] // Problem 1725. Sold Out! 24 Jun 2014 02:03
# include <iostream>
using namespace std;
int main ()
{
int n,k,sol;
    cin>>n>>k;
        if(int(n/2) && 1<=k<=n<=50){
        if(k<=n/2) sol=n-3;
        if(k>n/2) sol=k-3;
        if(n==2) sol=0;
        }
    cout<<sol<<endl;
}

Edited by author 26.06.2014 22:00
Chukharev ac // Problem 1725. Sold Out! 26 Jun 2014 22:00
AC

if(k<=n/2) sol=n-2-k;

Edited by author 09.07.2014 22:52