focus on that thing
here is problem link: http://lightoj.com/volume_showproblem.php?problem=1001
here is problem: 1001 - Opposite Task
Time Limit: 0.5 second(s) | Memory Limit: 32 MB |
This problem gives you a flavor the concept of special judge. That means the judge is smart enough to verify your code even though it may print different results. In this problem you are asked to find the opposite task of the previous problem.
To be specific, I have two computers where I stored my problems. Now I know the total number of problems is n. And there are no duplicate problems and there can be at most 10 problems in each computer. You have to find the number of problems in each of the computers.
Since there can be multiple solutions. Any valid solution will do.
Input
Input starts with an integer T (≤ 25), denoting the number of test cases.
Each case starts with a line containing an integer n (0 ≤ n ≤ 20) denoting the total number of problems.
Output
For each case, print the number of problems stored in each computer in a single line. A single space should separate the non-negative integers.
Sample Input | Output for Sample Input |
3
10
7
7
|
0 10
0 7
1 6
|
here is my solution link: http://ideone.com/1U2Kke
and here is my c++ solution to light OJ "1001 - opposite task" problem:
#include <iostream>
using namespace std;
int main() {
// your code goes here
int T, n;
cin >> T;
for (int i = 1; i <= T; i++) {
cin >> n;
if (n > 10) {
cout << n - 10 << " " << n - (n - 10) << "\n";
}
else {
cout << 0 << " " << n << "\n";
}
}
return 0;
}
No comments:
Post a Comment