Входной файл: | input.txt | Ограничение времени: | 5 сек | |
Выходной файл: | output.txt | Ограничение памяти: | 200 Мб |
№ | Входной файл (input.txt ) |
Выходной файл (output.txt ) |
---|---|---|
1 |
|
|
Author: | A. Zhuplev | Time limit: | 1 sec | |
Input file: | input.txt | Memory limit: | 256 Mb | |
Output file: | output.txt |
According to ISO stadnard Metric tire code, tire dimensions are described by a string of letters and numbers in the following format:
Rules of ACM (Any Car Modification) race specify a fixed tire dimensions for all participating cars. Young racer Vasya has not been able to find this type of tire. However, his car will still be approved for the race by judges only if radius of the wheel (wheel disk radius plus sidewall height) differs by at most K percent from that of the specified tire.
Note: 1 inch = 25.4 millimeters. Number a differs from b by at most c percent when 100 × |a − b| / b ≤ c.
First line of input file contains integer K.
Second and third lines contain Metric tire codes of specified tire and Vasya's tire respectively. Tire codes contain only digits, R and slash (ASCII 47) characters.
Output file must contain a single string — APPROVED if Vasya's car is approved to the race or DISAPPROVED otherwise.
0 ≤ K ≤ 100
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
Author: | A. Klenin | Time limit: | 2 sec | |
Input file: | input.txt | Memory limit: | 64 Mb | |
Output file: | output.txt |
Customer support department in an "Incomprehension Amateurs, Ltd" software company has call center for answering users' questions. Support prices are as follows:
1. | Answer to a question | 10 USD |
2. | Correct answer to a question | 20 USD |
3. | Correct answer to a question with explanation | 40 USD |
4. | Correct answer to a question which was already correctly answered before | +10 USD for each previous correct answer |
So, for example, if user asks the same question three times, first receives incorrect answer, then correct one, and the third time correct answer with explanation, it will cost him 10 + 20 + (40 + 1 * 10) = 80 USD.
Customers are billed monthly according to call log. Company engineers review the log and for each question determine:
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
Author: | A. Klenin | Time limit: | 2 sec | |
Input file: | input.txt | Memory limit: | 4 Mb | |
Output file: | output.txt |
Given the sequence of integers A1, A2, …, AN, find a number As such that there exists exactly one Am > As, and for all k ≠ m Ak ≤ As.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
Author: | A. Klenin | Time limit: | 1 sec | |
Input file: | input.txt | Memory limit: | 64 Mb | |
Output file: | output.txt |
Your task is the most trivial one: given non-negative integer N, output N + 1.
The only complication is that the integer is given in an unknown base between 2 and 36 inclusive. Because of that, your program should output all possible distinct answers in lexicographically increasing order.
N contains from 1 to 100 digits
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
Author: | T. Chistyakov, A. Klenin | Time limit: | 1 sec | |
Input file: | input.txt | Memory limit: | 256 Mb | |
Output file: | output.txt |
For given integers P and N you need to find all such values of x < 10N, that N last digits of xP are non-zero and equal.
Fortunately, there is not so many numbers showing this property. For example, for P = 2 and N = 2 there exist only 4 of them:
12, 38, 62, 88
Output the number of existing numbers X, then all these numbers in any order.
2 ≤ P ≤ 100
2 ≤ N ≤ 9
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
Author: | T.Chistyakov, A. Klenin | Time limit: | 2 sec | |
Input file: | input.txt | Memory limit: | 32 Mb | |
Output file: | output.txt |
At the running contest, jury used a new computerized stopwatch system to ensure the most accurate measuring of results. Unfortunately, despite very successfull trials, the system malfunctioned during the actual contest.
Jury was so confident in the new system that it did not use the old mechanical stopwatches. So the only way to determine outcome was to compare visual impressions of the people watching the contest. M such impressions were recorded, each in one of two forms: "runner A finished before runner B" and "runners A and B finished at the same time".
You task is to assign a place pi to each of N runners, such that
Additionally, places must be allocated as densely as possible, i.e. 1 ≤ pi ≤ K for minimum possible value of K.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
Author: | A. Klenin | Time limit: | 2 sec | |
Input file: | input.txt | Memory limit: | 200 Mb | |
Output file: | output.txt |
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 |
|
|
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: | A. Zhuplev, A. Klenin | Time limit: | 1 sec | |
Input file: | input.txt | Memory limit: | 256 Mb | |
Output file: | output.txt |
Underwater arithmetic is very elementary. There are just two operations: WITH and WITHOUT which mean addition and subtraction respectively.
Underwater mathematicians did not yet invent brackets, so all expressions are calculated from right to left. For example, the expression 3 WITH 5 WITHOUT 4 WITHOUT 7 is calculated as (3 + (5 − (4 − 7))).
Scientists of Nearsea Institute of Underwater Arithmetic need a program to evaluate such expressions.
First line of input file contains a single integer N. Following 2 × N + 1 lines describe the expression. Odd lines contain integer operands, even lines contain operations.
Output file must contain a single integer — calculation result.
1 ≤ N ≤ 103
All operands are in range from 0 to 103.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|
Author: | A. Klenin | Time limit: | 2 sec | |
Input file: | input.txt | Memory limit: | 64 Mb | |
Output file: | output.txt |
The puzzle game of Sudoku is played on a board of N2 × N2 cells. The cells are grouped in N × N squares of N × N cells each. Each cell is either empty or contains a number between 1 and N2.
The sudoku position is correct when numbers in each row, each column and each square are different. The goal of the game is, starting from some correct position, fill all empty cells so that the final position is still correct.
This game is fairly popular in the Internet, and there are many sites which allow visitors to solve puzzles online. Such sites always have a subroutine to determine a correctness of a given position.
You are to write such a routine.
No. | Input file (input.txt ) |
Output file (output.txt ) |
---|---|---|
1 |
|
|
2 |
|
|