A special site for solving fun programming problems and challenges, interested in computer science, programming, basics, data structure and algorithms

 


Round 1 Confusion Problem Code: CR0SolvedSubmit

Hey congratulate you all for qualified upto final Round, but this is not the end, final round it still remaining for that you need to crack some more problems. So here we go.

Our team is in confusion that how to work efficiect in given period of time. There are total N paper's out of which X are already checked and there are total K crew members to check the paper's.

But now we want to divide the paper's among our crew member, how sholud we divide the paper among us such that all get same no. of paper with minimum possibility.

Please help from this confusion as we running out of time.

Input:

  • First line will contain T, number of testcases. Then the testcases follow.

  • The first line of each test case contains three space separated integers NK and X.

  • where N and X are multiple of K.

Output:

  • For each test case print a single line containing a single integer denoting no. of paper with minimum possibility that each crew member get.

Constraints

  • 1T1000
  • 1KXN107

Subtasks

  • 100 points : Original Constraints

Sample Input:

   2
   20 4 8
   15 3 9

Sample Output:

    3
    2
------------------------------------------------------

solution in cpp

#include<iostream>
using namespace std;

int main()
{
	int n, k, x, sum;
	int t;
	cin >> t;
	for (int i = 0; i < t; i++)
	{
		cin >> n >> k >> x;
		sum = 0;
		sum += (n / k) - (x / k);
		cout << sum << "\n";
	}
	cout << "\n";
	return 0;
}

No comments:

Post a Comment