Author: | A. Klenin | Time limit: | 2 sec | |
Input file: | input.txt | Memory limit: | 64 Mb | |
Output file: | output.txt |
Igor is a computer science freshman student. As opposed to most of his classmates, he actually knows a little about computer programming. Because of this, other students often ask him to write their homework assignments for the "Introductory Programming" course.
He noticed that, although each assignment is unique, they usually follow a simple pattern. In particular, one assignment states:
"Count the number of integers in the array which are [greater than|less than|equal to|not equal to] [value]",
where parts in brackets differ from student to student. Assignments also contain sample input and output to encourage students to test their programs before submission.
Igor have many classmates, so to save time he decided to write a homework generator. He started with the following template:
count := 0; for i := 1 to N do if a[i] #cond# #value# then Inc(count);And now he wants to substitute #cond# and #value# based on the sample input from the assignment. Of course, generated program might be different from what was required in the assignment, but at least it would pass the sample test — his classmates are grateful to have even that. Do you know enough Introductory Programming to help Igor?
Your program will be given sample input — an array of N integer values, and the corresponding output R. It must find such substitution strings for #cond# and #value# that after execution of the code snippet above count will be equal to R, or determine that it is impossible.
The first line of output must contain one of the strings '<', '>', '=', '<>' — substitution for #cond#. The second line must contain an integer — substitution for #value#.
If there is no solution, output file must contain a single character '?' (ASCII 63). If there is more then one solution, output any of them.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
Author: | I. Tuphanov | Time limit: | 1 sec | |
Input file: | input.txt | Memory limit: | 256 Mb | |
Output file: | output.txt |
Young programmer Vasya is learning the beginnings of the algorithm complexity theory. For starters, he wants to be able to quickly estimate the number of iterations of nested loops. As a first example, he wrote the following code:
C | Pascal |
long long f(int n) { long long ans = 0; for (int i = 1; i <= n; i++) for (int j = i+1; j <= n; j++) for (int k = j+1; k <= n; k++) ans++; return ans; } |
function f(n: integer): int64; var i, j, k: integer; begin result := 0; for i := 1 to n do for j := i+1 to n do for k := j+1 to n do inc(result); end; |
Using your knowledge of the subject,
help Vasya calculate f(n)
for given n.
Input file contains an integer n.
Output file must contain a single integer — f(n)
.
1 ≤ n ≤ 106
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|