Lorem ipsum dolor sit amet, consectetur adipiscing elit. Test link

My very 1st contest! : MY1STCONTEST | CodeChef Solution

2 min read


Problem

Each contest - there are approximately 1500 - 2000 users who participate for the 1st time and get rated.

The Chef wanted to tell new users some tricks for their 1st contest:

  • Before the contest - you don’t have any rating. So even if you make a single submission - you will become part of the contest rank list and you will get a rating.
  • If you want your rating to increase - give the entire 3 hours to the contest & don’t quit! If you keep trying till the end, and the more time you get, the more problems you can solve. That means larger rating increases!
  • Do not ask your friends for their code. If you copy paste their code, you will get caught during plagiarism checks and your rating will be reduced by 275 points, along with a permanent black mark on your profile.

Now to the problem:

In a contest where N new users visited the contest,

  • A users just saw the problems and didn’t make any submissions and hence won’t get any rating.
  • B users who made a submission but could not solve any problem correctly. Thus, after the contest, they will get a rating in the range 800 - 1000.
  • Everyone else could correctly solve at least 1 problem. Thus, they will get a rating strictly greater than 1000 after the contest.

You need to output the number of new users in the contest who, after the contest, will get a rating and also the number of new users who will get a rating strictly greater than 1000.


Input Format

  • Each input file contains of a single line, with three integers N, A and B - the number of new users, the number of users who just saw the problem and didn't make any submission, and the number of users who made a submission but could not solve any problem correctly.

Output Format

Output two integers separated by a space in a single line - the number of new users who will get a rating at the end of the contest and the number of new users who will get a rating higher than 1000

.

Constraints

  • 2 \leq N \leq 1000
  • 1 \leq A \leq 1000
  • 1 \leq B \leq 1000
  • A + B \leq N

Sample 1:

Input
Output
10 3 2
7 5

Explanation:

There were 10 new users. Among those 103 didn't make any submissions. This means that the other 10 - 3 = 7 users made submissions and will get a rating. This is the first integer of the output.

Now, among these 7 users, 2 couldn't solve any problem even though they submitted and tried. So, they will get a rating less than equal to 1000. The other 7 - 2 = 5 users were able to solve at least 1 problem and hence will get a rating greater than 1000. Hence, the second integer of the output is 5.

Solution

#include <iostream>
using namespace std;

// Solution from : Code Radius [ https://radiuscode.blogspot.com/ ]

int main() {
int n,a,b;
cin>>n>>a>>b;
int p=n-a;
int k=p-b;

cout<<p<<" ";
cout<<k<<endl;
return 0;
}

Please First Try to Solve Problem by Yourself.

You may like these posts

  • post 6…
  • ObjectiveThis is a simple challenge to help you practice creating variables and printing to stdout. You may also want to complete Solve Me First in Python before attempting this ch…
  • ProblemChef is a big fan of Coldplay. Every Sunday, he will drive to a park taking MM minutes to reach there, and during the ride he will play a single song on a loop. Today, he ha…
  • ProblemAlice and Bob are meeting after a long time. As usual they love to play some math games. This times Alice takes the call and decides the game. The game is very simple, Alice…
  • Problem Gru has not been in the limelight for a long time and is, therefore, planning something particularly nefarious. Frustrated by his minions' incapability which has kept him…
  • post 1…

Post a Comment