sample_inputs
stringlengths
5
384
input_specification
stringlengths
48
911
src_uid
stringlengths
32
32
source_code
stringlengths
29
6.77k
sample_outputs
stringlengths
5
393
lang_cluster
stringclasses
4 values
notes
stringlengths
30
1.52k
βŒ€
output_specification
stringlengths
25
681
description
stringlengths
140
2.49k
human_testcases
stringlengths
243
50.8k
human_pass_rate
float64
100
100
human_line_coverage
float64
100
100
human_branch_coverage
float64
100
100
human_sample_testcases_1
stringlengths
190
3.11k
human_sample_testcases_2
stringlengths
190
3.11k
human_sample_testcases_3
stringlengths
190
3.11k
human_sample_testcases_4
stringlengths
190
3.11k
human_sample_testcases_5
stringlengths
190
3.11k
human_sample_pass_rate_1
float64
100
100
human_sample_pass_rate_2
float64
100
100
human_sample_pass_rate_3
float64
100
100
human_sample_pass_rate_4
float64
100
100
human_sample_pass_rate_5
float64
100
100
human_sample_line_coverage_1
float64
52.2
100
human_sample_line_coverage_2
float64
60
100
human_sample_line_coverage_3
float64
50
100
human_sample_line_coverage_4
float64
43.5
100
human_sample_line_coverage_5
float64
21.7
100
human_sample_branch_coverage_1
float64
45.5
100
human_sample_branch_coverage_2
float64
45.8
100
human_sample_branch_coverage_3
float64
16.7
100
human_sample_branch_coverage_4
float64
36.4
100
human_sample_branch_coverage_5
float64
18.2
100
id
int64
1
400
human_sample_pass_rate
float64
100
100
human_sample_line_coverage
float64
47
100
human_sample_branch_coverage
float64
41.8
100
["6 3\n1 1 1 0 1 0", "5 2\n0 0 0 1 0"]
The first line of the input contains two integers n and a (1 ≀ a ≀ n ≀ 100)Β β€” the number of cities and the index of city where Limak lives. The second line contains n integers t1, t2, ..., tn (0 ≀ ti ≀ 1). There are ti criminals in the i-th city.
4840d571d4ce6e1096bb678b6c100ae5
#include<stdio.h> int main() { int n,i,j,pos,counter; int criminals[100]; counter=0; scanf("%d%d",&n,&pos); for(i=0;i<n;i++) scanf("%d",&criminals[i]); if(criminals[pos-1]==1) counter+=1; for(j=1;j<=i;j++) { if((pos-1-j>=0)&&(pos-1+j<n)&&((criminals[pos-1-j]&criminals[pos-1+j])==1)) counter+=2; else if((pos-1-j>=0)&&(pos-1+j>=n)&&(criminals[pos-1-j]==1)) counter+=1; else if((pos-1-j<0)&&(pos-1+j<n)&&(criminals[pos-1+j]==1)) counter+=1;} printf("%d",counter); return 0;}
["3", "1"]
C
NoteIn the first sample, there are six cities and Limak lives in the third one (blue arrow below). Criminals are in cities marked red. Using the BCD gives Limak the following information: There is one criminal at distance 0 from the third cityΒ β€” Limak is sure that this criminal is exactly in the third city. There is one criminal at distance 1 from the third cityΒ β€” Limak doesn't know if a criminal is in the second or fourth city. There are two criminals at distance 2 from the third cityΒ β€” Limak is sure that there is one criminal in the first city and one in the fifth city. There are zero criminals for every greater distance. So, Limak will catch criminals in cities 1, 3 and 5, that is 3 criminals in total.In the second sample (drawing below), the BCD gives Limak the information that there is one criminal at distance 2 from Limak's city. There is only one city at distance 2 so Limak is sure where a criminal is.
Print the number of criminals Limak will catch.
There are n cities in Bearland, numbered 1 through n. Cities are arranged in one long row. The distance between cities i and j is equal to |i - j|.Limak is a police officer. He lives in a city a. His job is to catch criminals. It's hard because he doesn't know in which cities criminals are. Though, he knows that there is at most one criminal in each city.Limak is going to use a BCD (Bear Criminal Detector). The BCD will tell Limak how many criminals there are for every distance from a city a. After that, Limak can catch a criminal in each city for which he is sure that there must be a criminal.You know in which cities criminals are. Count the number of criminals Limak will catch, after he uses the BCD.
[{"input": "6 3\r\n1 1 1 0 1 0\r\n", "output": ["3"]}, {"input": "5 2\r\n0 0 0 1 0\r\n", "output": ["1"]}, {"input": "1 1\r\n1\r\n", "output": ["1"]}, {"input": "1 1\r\n0\r\n", "output": ["0"]}, {"input": "9 3\r\n1 1 1 1 1 1 1 1 0\r\n", "output": ["8"]}, {"input": "9 5\r\n1 0 1 0 1 0 1 0 1\r\n", "output": ["5"]}, {"input": "20 17\r\n1 1 0 1 1 1 1 0 1 0 1 1 1 0 1 1 0 0 0 0\r\n", "output": ["10"]}, {"input": "100 60\r\n1 1 1 1 1 1 0 1 0 0 1 1 0 1 1 1 1 1 0 0 1 1 0 0 0 0 0 1 0 1 1 0 1 0 1 0 1 0 1 1 0 0 0 0 0 1 1 1 0 1 1 0 0 0 1 0 0 0 1 1 1 0 1 0 0 1 1 1 0 1 1 1 0 0 1 1 0 1 0 0 0 1 0 0 0 0 0 0 1 1 1 0 0 1 1 1 0 1 0 0\r\n", "output": ["27"]}, {"input": "8 1\r\n1 0 1 1 0 0 1 0\r\n", "output": ["4"]}, {"input": "11 11\r\n0 1 0 0 1 1 1 0 0 0 0\r\n", "output": ["4"]}, {"input": "19 10\r\n0 1 1 0 1 0 0 1 1 0 0 1 0 1 0 0 1 0 1\r\n", "output": ["4"]}, {"input": "100 38\r\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r\n", "output": ["0"]}, {"input": "100 38\r\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r\n", "output": ["1"]}, {"input": "100 38\r\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r\n", "output": ["3"]}, {"input": "99 38\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\r\n", "output": ["25"]}, {"input": "99 38\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\r\n", "output": ["24"]}, {"input": "99 38\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\r\n", "output": ["24"]}, {"input": "98 70\r\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r\n", "output": ["41"]}, {"input": "99 70\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\r\n", "output": ["9"]}, {"input": "99 60\r\n0 0 0 1 1 0 1 1 0 0 1 0 0 0 0 0 1 0 1 0 0 0 1 0 1 1 1 0 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 0 0 0 0 0 1 0 0 1 0 1 1 1 1 1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0 1 1 1 0 0 0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 1 1 1\r\n", "output": ["34"]}, {"input": "98 24\r\n0 0 0 1 1 0 1 1 0 0 0 0 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 0 1 0 0 1 1 0 1 1 1 0 1 0 0 1 0 0 0 1 1 1 1 0 1 1 1 0 1 1 1 1 0 0 1 0 0 0 1 0 1 1 0 1 0 1 1 1 0 0 1 0 0 0 1 1 0 0 1 1 1 1 1 1 0 1 0 1 0 0 1 1\r\n", "output": ["39"]}, {"input": "100 100\r\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\r\n", "output": ["100"]}, {"input": "100 1\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r\n", "output": ["0"]}, {"input": "2 1\r\n0 1\r\n", "output": ["1"]}]
100
100
100
[{'input': '6 3\r\n1 1 1 0 1 0\r\n', 'output': ['3']}, {'input': '98 24\r\n0 0 0 1 1 0 1 1 0 0 0 0 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 0 1 0 0 1 1 0 1 1 1 0 1 0 0 1 0 0 0 1 1 1 1 0 1 1 1 0 1 1 1 1 0 0 1 0 0 0 1 0 1 1 0 1 0 1 1 1 0 0 1 0 0 0 1 1 0 0 1 1 1 1 1 1 0 1 0 1 0 0 1 1\r\n', 'output': ['39']}, {'input': '8 1\r\n1 0 1 1 0 0 1 0\r\n', 'output': ['4']}, {'input': '99 38\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\r\n', 'output': ['25']}, {'input': '5 2\r\n0 0 0 1 0\r\n', 'output': ['1']}]
[{'input': '99 38\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\r\n', 'output': ['24']}, {'input': '99 70\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\r\n', 'output': ['9']}, {'input': '100 38\r\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r\n', 'output': ['3']}, {'input': '100 100\r\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\r\n', 'output': ['100']}, {'input': '19 10\r\n0 1 1 0 1 0 0 1 1 0 0 1 0 1 0 0 1 0 1\r\n', 'output': ['4']}]
[{'input': '6 3\r\n1 1 1 0 1 0\r\n', 'output': ['3']}, {'input': '1 1\r\n0\r\n', 'output': ['0']}, {'input': '100 60\r\n1 1 1 1 1 1 0 1 0 0 1 1 0 1 1 1 1 1 0 0 1 1 0 0 0 0 0 1 0 1 1 0 1 0 1 0 1 0 1 1 0 0 0 0 0 1 1 1 0 1 1 0 0 0 1 0 0 0 1 1 1 0 1 0 0 1 1 1 0 1 1 1 0 0 1 1 0 1 0 0 0 1 0 0 0 0 0 0 1 1 1 0 0 1 1 1 0 1 0 0\r\n', 'output': ['27']}, {'input': '20 17\r\n1 1 0 1 1 1 1 0 1 0 1 1 1 0 1 1 0 0 0 0\r\n', 'output': ['10']}, {'input': '98 70\r\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r\n', 'output': ['41']}]
[{'input': '100 38\r\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r\n', 'output': ['1']}, {'input': '100 1\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r\n', 'output': ['0']}, {'input': '99 38\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\r\n', 'output': ['24']}, {'input': '5 2\r\n0 0 0 1 0\r\n', 'output': ['1']}, {'input': '100 38\r\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\r\n', 'output': ['3']}]
[{'input': '19 10\r\n0 1 1 0 1 0 0 1 1 0 0 1 0 1 0 0 1 0 1\r\n', 'output': ['4']}, {'input': '99 38\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\r\n', 'output': ['24']}, {'input': '11 11\r\n0 1 0 0 1 1 1 0 0 0 0\r\n', 'output': ['4']}, {'input': '99 70\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\r\n', 'output': ['9']}, {'input': '99 38\r\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\r\n', 'output': ['24']}]
100
100
100
100
100
93.75
100
93.75
93.75
100
83.33
100
95.83
83.33
95.83
1
100
96.25
91.664
["9 7 3 8", "2 7 3 7", "30 6 17 19"]
The only line contains four integer numbers $$$n$$$, $$$m$$$, $$$a$$$ and $$$b$$$ ($$$1 \le n, m \le 10^{12}$$$, $$$1 \le a, b \le 100$$$), where $$$n$$$ is the initial number of the commentary boxes, $$$m$$$ is the number of delegations to come, $$$a$$$ is the fee to build a box and $$$b$$$ is the fee to demolish a box.
c05d753b35545176ad468b99ff13aa39
#include<stdio.h> int main() { long long int c,a,n,m,b,d,e,f; scanf("%lld%lld%lld%lld",&n,&m,&a,&b); c=n%m; d=m-n%m; b=b*c; a=a*d; if(a>b) printf("%lld\n",b); else printf("%lld\n",a); return 0; }
["15", "14", "0"]
C
NoteIn the first example organizers can build $$$5$$$ boxes to make the total of $$$14$$$ paying $$$3$$$ burles for the each of them.In the second example organizers can demolish $$$2$$$ boxes to make the total of $$$0$$$ paying $$$7$$$ burles for the each of them.In the third example organizers are already able to distribute all the boxes equally among the delegations, each one get $$$5$$$ boxes.
Output the minimal amount of burles organizers should pay to satisfy all the delegations (i.e. to make the number of the boxes be divisible by $$$m$$$). It is allowed that the final number of the boxes is equal to $$$0$$$.
Berland Football Cup starts really soon! Commentators from all over the world come to the event.Organizers have already built $$$n$$$ commentary boxes. $$$m$$$ regional delegations will come to the Cup. Every delegation should get the same number of the commentary boxes. If any box is left unoccupied then the delegations will be upset. So each box should be occupied by exactly one delegation.If $$$n$$$ is not divisible by $$$m$$$, it is impossible to distribute the boxes to the delegations at the moment.Organizers can build a new commentary box paying $$$a$$$ burles and demolish a commentary box paying $$$b$$$ burles. They can both build and demolish boxes arbitrary number of times (each time paying a corresponding fee). It is allowed to demolish all the existing boxes.What is the minimal amount of burles organizers should pay to satisfy all the delegations (i.e. to make the number of the boxes be divisible by $$$m$$$)?
[{"input": "9 7 3 8\r\n", "output": ["15"]}, {"input": "2 7 3 7\r\n", "output": ["14"]}, {"input": "30 6 17 19\r\n", "output": ["0"]}, {"input": "500000000001 1000000000000 100 100\r\n", "output": ["49999999999900"]}, {"input": "1000000000000 750000000001 10 100\r\n", "output": ["5000000000020"]}, {"input": "1000000000000 750000000001 100 10\r\n", "output": ["2499999999990"]}, {"input": "42 1 1 1\r\n", "output": ["0"]}, {"input": "1 1000000000000 1 100\r\n", "output": ["100"]}, {"input": "7 2 3 7\r\n", "output": ["3"]}, {"input": "999999999 2 1 1\r\n", "output": ["1"]}, {"input": "999999999999 10000000007 100 100\r\n", "output": ["70100"]}, {"input": "10000000001 2 1 1\r\n", "output": ["1"]}, {"input": "29 6 1 2\r\n", "output": ["1"]}, {"input": "99999999999 6 100 100\r\n", "output": ["300"]}, {"input": "1000000000000 7 3 8\r\n", "output": ["8"]}, {"input": "99999999999 2 1 1\r\n", "output": ["1"]}, {"input": "1 2 1 1\r\n", "output": ["1"]}, {"input": "999999999999 2 1 1\r\n", "output": ["1"]}, {"input": "9 2 1 1\r\n", "output": ["1"]}, {"input": "17 4 5 5\r\n", "output": ["5"]}, {"input": "100000000000 3 1 1\r\n", "output": ["1"]}, {"input": "100 7 1 1\r\n", "output": ["2"]}, {"input": "1000000000000 3 100 100\r\n", "output": ["100"]}, {"input": "70 3 10 10\r\n", "output": ["10"]}, {"input": "1 2 5 1\r\n", "output": ["1"]}, {"input": "1000000000000 3 1 1\r\n", "output": ["1"]}, {"input": "804289377 846930887 78 16\r\n", "output": ["3326037780"]}, {"input": "1000000000000 9 55 55\r\n", "output": ["55"]}, {"input": "957747787 424238336 87 93\r\n", "output": ["10162213695"]}, {"input": "25 6 1 2\r\n", "output": ["2"]}, {"input": "22 7 3 8\r\n", "output": ["8"]}, {"input": "10000000000 1 1 1\r\n", "output": ["0"]}, {"input": "999999999999 2 10 10\r\n", "output": ["10"]}, {"input": "999999999999 2 100 100\r\n", "output": ["100"]}, {"input": "100 3 3 8\r\n", "output": ["6"]}, {"input": "99999 2 1 1\r\n", "output": ["1"]}, {"input": "100 3 2 5\r\n", "output": ["4"]}, {"input": "1000000000000 13 10 17\r\n", "output": ["17"]}, {"input": "7 2 1 2\r\n", "output": ["1"]}, {"input": "10 3 1 2\r\n", "output": ["2"]}, {"input": "5 2 2 2\r\n", "output": ["2"]}, {"input": "100 3 5 2\r\n", "output": ["2"]}, {"input": "7 2 1 1\r\n", "output": ["1"]}, {"input": "70 4 1 1\r\n", "output": ["2"]}, {"input": "10 4 1 1\r\n", "output": ["2"]}, {"input": "6 7 41 42\r\n", "output": ["41"]}, {"input": "10 3 10 1\r\n", "output": ["1"]}, {"input": "5 5 2 3\r\n", "output": ["0"]}, {"input": "1000000000000 3 99 99\r\n", "output": ["99"]}, {"input": "7 3 100 1\r\n", "output": ["1"]}, {"input": "7 2 100 5\r\n", "output": ["5"]}, {"input": "1000000000000 1 23 33\r\n", "output": ["0"]}, {"input": "30 7 1 1\r\n", "output": ["2"]}, {"input": "100 3 1 1\r\n", "output": ["1"]}, {"input": "90001 300 100 1\r\n", "output": ["1"]}, {"input": "13 4 1 2\r\n", "output": ["2"]}, {"input": "1000000000000 6 1 3\r\n", "output": ["2"]}, {"input": "50 4 5 100\r\n", "output": ["10"]}, {"input": "999 2 1 1\r\n", "output": ["1"]}, {"input": "5 2 5 5\r\n", "output": ["5"]}, {"input": "20 3 3 3\r\n", "output": ["3"]}, {"input": "3982258181 1589052704 87 20\r\n", "output": ["16083055460"]}, {"input": "100 3 1 3\r\n", "output": ["2"]}, {"input": "7 3 1 1\r\n", "output": ["1"]}, {"input": "19 10 100 100\r\n", "output": ["100"]}, {"input": "23 3 100 1\r\n", "output": ["2"]}, {"input": "25 7 100 1\r\n", "output": ["4"]}, {"input": "100 9 1 2\r\n", "output": ["2"]}, {"input": "9999999999 2 1 100\r\n", "output": ["1"]}, {"input": "1000000000000 2 1 1\r\n", "output": ["0"]}, {"input": "10000 3 1 1\r\n", "output": ["1"]}, {"input": "22 7 1 6\r\n", "output": ["6"]}, {"input": "100000000000 1 1 1\r\n", "output": ["0"]}, {"input": "18 7 100 1\r\n", "output": ["4"]}, {"input": "10003 4 1 100\r\n", "output": ["1"]}, {"input": "3205261341 718648876 58 11\r\n", "output": ["3637324207"]}, {"input": "8 3 100 1\r\n", "output": ["2"]}, {"input": "15 7 1 1\r\n", "output": ["1"]}, {"input": "1000000000000 1 20 20\r\n", "output": ["0"]}, {"input": "16 7 3 2\r\n", "output": ["4"]}, {"input": "1000000000000 1 1 1\r\n", "output": ["0"]}, {"input": "7 3 1 100\r\n", "output": ["2"]}, {"input": "16 3 1 100\r\n", "output": ["2"]}, {"input": "13 4 1 10\r\n", "output": ["3"]}, {"input": "10 4 5 5\r\n", "output": ["10"]}, {"input": "14 3 1 100\r\n", "output": ["1"]}, {"input": "100 33 100 1\r\n", "output": ["1"]}, {"input": "22 7 1 8\r\n", "output": ["6"]}, {"input": "10 4 2 1\r\n", "output": ["2"]}, {"input": "6 4 2 2\r\n", "output": ["4"]}, {"input": "17 4 2 1\r\n", "output": ["1"]}, {"input": "7 3 100 10\r\n", "output": ["10"]}, {"input": "702 7 3 2\r\n", "output": ["4"]}, {"input": "8 3 1 5\r\n", "output": ["1"]}, {"input": "3 2 5 2\r\n", "output": ["2"]}, {"input": "99 19 1 7\r\n", "output": ["15"]}, {"input": "16 3 100 1\r\n", "output": ["1"]}, {"input": "100 34 1 100\r\n", "output": ["2"]}, {"input": "100 33 1 1\r\n", "output": ["1"]}, {"input": "2 3 4 3\r\n", "output": ["4"]}, {"input": "15 4 4 10\r\n", "output": ["4"]}, {"input": "1144108931 470211273 45 79\r\n", "output": ["11993619960"]}, {"input": "2 3 3 4\r\n", "output": ["3"]}, {"input": "29 5 4 9\r\n", "output": ["4"]}, {"input": "15 7 1 5\r\n", "output": ["5"]}, {"input": "1 1 1 1\r\n", "output": ["0"]}, {"input": "1 1 3 4\r\n", "output": ["0"]}, {"input": "10 12 2 1\r\n", "output": ["4"]}, {"input": "1 2 3 4\r\n", "output": ["3"]}]
100
100
100
[{'input': '7 3 100 1\r\n', 'output': ['1']}, {'input': '7 2 1 2\r\n', 'output': ['1']}, {'input': '100000000000 3 1 1\r\n', 'output': ['1']}, {'input': '957747787 424238336 87 93\r\n', 'output': ['10162213695']}, {'input': '10 12 2 1\r\n', 'output': ['4']}]
[{'input': '1 1 1 1\r\n', 'output': ['0']}, {'input': '100 3 2 5\r\n', 'output': ['4']}, {'input': '10000000001 2 1 1\r\n', 'output': ['1']}, {'input': '5 5 2 3\r\n', 'output': ['0']}, {'input': '30 6 17 19\r\n', 'output': ['0']}]
[{'input': '100 7 1 1\r\n', 'output': ['2']}, {'input': '29 5 4 9\r\n', 'output': ['4']}, {'input': '25 7 100 1\r\n', 'output': ['4']}, {'input': '100 3 5 2\r\n', 'output': ['2']}, {'input': '70 4 1 1\r\n', 'output': ['2']}]
[{'input': '7 2 100 5\r\n', 'output': ['5']}, {'input': '7 3 100 1\r\n', 'output': ['1']}, {'input': '70 4 1 1\r\n', 'output': ['2']}, {'input': '100 7 1 1\r\n', 'output': ['2']}, {'input': '999999999999 10000000007 100 100\r\n', 'output': ['70100']}]
[{'input': '1000000000000 3 99 99\r\n', 'output': ['99']}, {'input': '15 4 4 10\r\n', 'output': ['4']}, {'input': '1000000000000 2 1 1\r\n', 'output': ['0']}, {'input': '3205261341 718648876 58 11\r\n', 'output': ['3637324207']}, {'input': '10000000001 2 1 1\r\n', 'output': ['1']}]
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
2
100
100
100
["3000"]
The only line of the input contains one integer n (1 ≀ n ≀ 1018) β€” the prediction on the number of people who will buy the game.
8551308e5ff435e0fc507b89a912408a
#include<stdio.h> int main() { long long int i,j,n,l,a,k; scanf("%lld",&n); k=2520; a=n/k; printf("%lld\n",a); return 0; }
["1"]
C
null
Output one integer showing how many numbers from 1 to n are divisible by all numbers from 2 to 10.
IT City company developing computer games invented a new way to reward its employees. After a new game release users start buying it actively, and the company tracks the number of sales with precision to each transaction. Every time when the next number of sales is divisible by all numbers from 2 to 10 every developer of this game gets a small bonus.A game designer Petya knows that the company is just about to release a new game that was partly developed by him. On the basis of his experience he predicts that n people will buy the game during the first month. Now Petya wants to determine how many times he will get the bonus. Help him to know it.
[{"input": "3000\r\n", "output": ["1"]}, {"input": "2520\r\n", "output": ["1"]}, {"input": "2519\r\n", "output": ["0"]}, {"input": "2521\r\n", "output": ["1"]}, {"input": "1\r\n", "output": ["0"]}, {"input": "314159265\r\n", "output": ["124666"]}, {"input": "718281828459045235\r\n", "output": ["285032471610732"]}, {"input": "1000000000000000000\r\n", "output": ["396825396825396"]}, {"input": "987654321234567890\r\n", "output": ["391926317950225"]}, {"input": "3628800\r\n", "output": ["1440"]}, {"input": "504000000000000000\r\n", "output": ["200000000000000"]}]
100
100
100
[{'input': '2521\r\n', 'output': ['1']}, {'input': '2520\r\n', 'output': ['1']}, {'input': '3628800\r\n', 'output': ['1440']}, {'input': '2519\r\n', 'output': ['0']}, {'input': '718281828459045235\r\n', 'output': ['285032471610732']}]
[{'input': '3000\r\n', 'output': ['1']}, {'input': '2519\r\n', 'output': ['0']}, {'input': '987654321234567890\r\n', 'output': ['391926317950225']}, {'input': '1\r\n', 'output': ['0']}, {'input': '1000000000000000000\r\n', 'output': ['396825396825396']}]
[{'input': '504000000000000000\r\n', 'output': ['200000000000000']}, {'input': '2521\r\n', 'output': ['1']}, {'input': '3000\r\n', 'output': ['1']}, {'input': '1\r\n', 'output': ['0']}, {'input': '718281828459045235\r\n', 'output': ['285032471610732']}]
[{'input': '1000000000000000000\r\n', 'output': ['396825396825396']}, {'input': '987654321234567890\r\n', 'output': ['391926317950225']}, {'input': '3628800\r\n', 'output': ['1440']}, {'input': '718281828459045235\r\n', 'output': ['285032471610732']}, {'input': '314159265\r\n', 'output': ['124666']}]
[{'input': '2520\r\n', 'output': ['1']}, {'input': '1000000000000000000\r\n', 'output': ['396825396825396']}, {'input': '1\r\n', 'output': ['0']}, {'input': '3000\r\n', 'output': ['1']}, {'input': '3628800\r\n', 'output': ['1440']}]
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
3
100
100
100
["2 6 2 2", "1 9 1 2"]
The first line of the input contains four integers d, L, v1, v2 (1 ≀ d, L, v1, v2 ≀ 10 000, d &lt; L)Β β€” Luke's width, the initial position of the second press and the speed of the first and second presses, respectively.
f34f3f974a21144b9f6e8615c41830f5
#include<stdio.h> main(){ double d,l,v1,v2; scanf("%lf %lf %lf %lf",&d,&l,&v1,&v2); printf("%0.10lf",(l-d)/(v1+v2)); }
["1.00000000000000000000", "2.66666666666666650000"]
C
NoteIn the first sample Luke should stay exactly in the middle of the segment, that is at coordinates [2;4], as the presses move with the same speed.In the second sample he needs to occupy the position . In this case both presses move to his edges at the same time.
Print a single real valueΒ β€” the maximum period of time Luke can stay alive for. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
Luke Skywalker got locked up in a rubbish shredder between two presses. R2D2 is already working on his rescue, but Luke needs to stay alive as long as possible. For simplicity we will assume that everything happens on a straight line, the presses are initially at coordinates 0 and L, and they move towards each other with speed v1 and v2, respectively. Luke has width d and is able to choose any position between the presses. Luke dies as soon as the distance between the presses is less than his width. Your task is to determine for how long Luke can stay alive.
[{"input": "2 6 2 2\r\n", "output": ["1.0000000", "1.000000", "1.0", "1.00000000000000000000", "1.0000000000"]}, {"input": "1 9 1 2\r\n", "output": ["2.66666666666666666674", "2.66666666667", "2.6666666666666665", "2.6666667", "2.66666666666666650000", "2.666667", "2.6666666667", "2.66666666666666651864"]}, {"input": "1 10000 1 1\r\n", "output": ["4999.50000000000000000000", "4999.500000", "4999.5", "4999.5000000", "4999.5000000000"]}, {"input": "9999 10000 10000 10000\r\n", "output": ["0.000050", "0.0000500000", "0.00005000000000000000", "0.0000500", "5.0E-5", "5e-05"]}, {"input": "1023 2340 1029 3021\r\n", "output": ["0.32518518518518518823", "0.3251852", "0.32518518518518519000", "0.325185", "0.32518518518518518519", "0.325185185185", "0.3251851852", "0.3251851851851852"]}, {"input": "2173 2176 10000 9989\r\n", "output": ["0.00015008254539996998", "0.0001500825454", "0.0001500825", "0.0001501", "1.5008254539996998E-4", "0.000150"]}, {"input": "1 2 123 1\r\n", "output": ["0.00806451612903225784", "0.00806451612903225780", "0.00806451612903225806", "0.0080645", "0.008064516129032258", "0.008065", "0.00806451612903", "0.0080645161"]}, {"input": "123 1242 12 312\r\n", "output": ["3.4537037037037037", "3.45370370370370370367", "3.453704", "3.45370370370370370000", "3.4537037037", "3.45370370370370372015", "3.4537037"]}, {"input": "2 9997 3 12\r\n", "output": ["666.3333333333334", "666.33333333333337000000", "666.333333", "666.33333333333333331483", "666.333333333", "666.33333333333337122895", "666.3333333333", "666.3333333"]}, {"input": "1 10000 10000 10000\r\n", "output": ["0.49995000000000001000", "0.4999500000", "0.49995000000000000551", "0.49995", "0.49995000000000000000", "0.4999500", "0.499950"]}, {"input": "3274 4728 888 4578\r\n", "output": ["0.2660080", "0.26600804976216613", "0.2660080498", "0.26600804976216613218", "0.266008049762", "0.26600804976216611781", "0.266008", "0.26600804976216613000"]}, {"input": "4600 9696 5634 8248\r\n", "output": ["0.36709407866301685000", "0.3670941", "0.367094", "0.36709407866301685397", "0.3670940787", "0.36709407866301685635", "0.367094078663", "0.36709407866301685"]}, {"input": "2255 7902 8891 429\r\n", "output": ["0.60590128755364806867", "0.60590128755364803000", "0.6059013", "0.605901", "0.605901287554", "0.60590128755364802693", "0.6059012876", "0.605901287553648"]}, {"input": "6745 9881 2149 9907\r\n", "output": ["0.260119442601", "0.2601194426011944", "0.2601194", "0.26011944260119442601", "0.26011944260119440608", "0.26011944260119441000", "0.2601194426", "0.260119"]}, {"input": "4400 8021 6895 2089\r\n", "output": ["0.403049866429", "0.40304986642920748000", "0.40304986642920748174", "0.4030498664292075", "0.40304986642920747995", "0.403050", "0.4030498664", "0.4030499"]}, {"input": "5726 9082 7448 3054\r\n", "output": ["0.319558179394", "0.3195582", "0.3195581794", "0.319558", "0.31955817939440107000", "0.31955817939440106648", "0.31955817939440106512", "0.31955817939440107"]}, {"input": "3381 9769 4898 2532\r\n", "output": ["0.859757738896", "0.8597577", "0.8597577389", "0.8597577388963661", "0.85975773889636609000", "0.85975773889636608605", "0.859758", "0.85975773889636608344"]}, {"input": "1036 6259 5451 4713\r\n", "output": ["0.51387249114521838000", "0.513872", "0.5138724911", "0.5138724911452184", "0.51387249114521837967", "0.51387249114521841794", "0.513872491145", "0.5138725"]}, {"input": "5526 6455 197 4191\r\n", "output": ["0.2117137648131267", "0.21171376481312670359", "0.2117137648", "0.211713764813", "0.2117138", "0.21171376481312670000", "0.211714", "0.21171376481312670920"]}, {"input": "1196 4082 4071 9971\r\n", "output": ["0.2055263", "0.20552627830793335217", "0.20552627830793334282", "0.2055262783", "0.205526278308", "0.20552627830793335000", "0.205526", "0.20552627830793335"]}, {"input": "8850 9921 8816 9449\r\n", "output": ["0.0586367", "0.05863673692855187517", "0.05863673692855187608", "0.0586367369", "0.0586367369286", "0.058637", "0.05863673692855187600", "0.058636736928551876"]}, {"input": "3341 7299 2074 8927\r\n", "output": ["0.35978547404781386000", "0.3597854740", "0.359785474048", "0.35978547404781383511", "0.35978547404781385799", "0.35978547404781386", "0.3597855", "0.359785"]}, {"input": "7831 8609 6820 2596\r\n", "output": ["0.082625", "0.08262531860662701784", "0.0826253186", "0.08262531860662701566", "0.08262531860662702", "0.08262531860662701600", "0.0826253186066", "0.0826253"]}, {"input": "2322 7212 77 4778\r\n", "output": ["1.00720906282183316166", "1.007209062821833", "1.00720906282183308988", "1.00720906282183310000", "1.00720906282", "1.0072091", "1.007209", "1.0072090628"]}, {"input": "9976 9996 4823 4255\r\n", "output": ["0.0022031284", "0.00220312844239", "0.00220312844238819110", "0.002203128442388191", "0.002203", "0.00220312844238819113", "0.0022031", "0.00220312844238819123"]}, {"input": "7631 9769 5377 6437\r\n", "output": ["0.18097172845776196559", "0.1809717285", "0.180971728458", "0.18097172845776197000", "0.1809717", "0.18097172845776197731", "0.180972", "0.18097172845776197"]}, {"input": "8957 9525 8634 107\r\n", "output": ["0.064981", "0.0649811", "0.06498112344125385", "0.06498112344125385464", "0.06498112344125385500", "0.06498112344125386112", "0.0649811234", "0.0649811234413"]}, {"input": "6612 9565 3380 2288\r\n", "output": ["0.52099505998588567399", "0.52099505998588568900", "0.520995", "0.5209950599858857", "0.520995059986", "0.5209951", "0.5209950600", "0.52099505998588569000"]}, {"input": "1103 6256 3934 9062\r\n", "output": ["0.39650661742074483", "0.39650661742074484457", "0.39650661742074483351", "0.3965066", "0.396506617421", "0.39650661742074483000", "0.3965066174", "0.396507"]}, {"input": "1854 3280 1481 2140\r\n", "output": ["0.393814", "0.3938139", "0.39381386357359843000", "0.393813863574", "0.39381386357359843", "0.39381386357359845346", "0.3938138636", "0.39381386357359843275"]}, {"input": "2 6 2 2\r\n", "output": ["1.0", "1", "1.000000", "1.0000000000"]}, {"input": "1 9 1 2\r\n", "output": ["2.6666666667", "2.6666666666666665", "2.666667"]}, {"input": "1 10000 1 1\r\n", "output": ["4999.5", "4999.500000", "4999.5000000000"]}, {"input": "9999 10000 10000 10000\r\n", "output": ["0.000050", "0.0000500000", "5.0E-5", "5e-005"]}, {"input": "1023 2340 1029 3021\r\n", "output": ["0.325185", "0.3251852", "0.3251851852", "0.3251851851851852"]}, {"input": "2173 2176 10000 9989\r\n", "output": ["0.0001500825", "1.5008254539996998E-4", "0.000150"]}, {"input": "1 2 123 1\r\n", "output": ["0.0080645161", "0.008064516129032258", "0.008064516", "0.008065"]}, {"input": "123 1242 12 312\r\n", "output": ["3.453704", "3.4537037037037037", "3.4537037037"]}, {"input": "2 9997 3 12\r\n", "output": ["666.3333333333", "666.333333", "666.3333", "666.3333333333334"]}, {"input": "1 10000 10000 10000\r\n", "output": ["0.49995", "0.4999500000", "0.499950"]}, {"input": "3274 4728 888 4578\r\n", "output": ["0.26600804976216613", "0.2660080498", "0.266008"]}, {"input": "4600 9696 5634 8248\r\n", "output": ["0.367094", "0.36709407866301685", "0.3670941", "0.3670940787"]}, {"input": "2255 7902 8891 429\r\n", "output": ["0.605901", "0.6059012876", "0.605901287553648", "0.6059013"]}, {"input": "6745 9881 2149 9907\r\n", "output": ["0.2601194426011944", "0.2601194426", "0.2601194", "0.260119"]}, {"input": "4400 8021 6895 2089\r\n", "output": ["0.4030499", "0.4030498664", "0.4030498664292075", "0.403050"]}, {"input": "5726 9082 7448 3054\r\n", "output": ["0.31955817939440107", "0.319558", "0.3195581794", "0.3195582"]}, {"input": "3381 9769 4898 2532\r\n", "output": ["0.8597577388963661", "0.8597577", "0.8597577389", "0.859758"]}, {"input": "1036 6259 5451 4713\r\n", "output": ["0.5138724911452184", "0.5138724911", "0.5138725", "0.513872"]}, {"input": "5526 6455 197 4191\r\n", "output": ["0.2117137648", "0.211714", "0.2117138", "0.2117137648131267"]}, {"input": "1196 4082 4071 9971\r\n", "output": ["0.205526", "0.2055263", "0.2055262783", "0.20552627830793335"]}, {"input": "8850 9921 8816 9449\r\n", "output": ["0.058637", "0.05863674", "0.0586367369", "0.058636736928551876"]}, {"input": "3341 7299 2074 8927\r\n", "output": ["0.359785", "0.3597854740", "0.35978547404781386", "0.3597855"]}, {"input": "7831 8609 6820 2596\r\n", "output": ["0.082625", "0.08262532", "0.0826253186", "0.08262531860662702"]}, {"input": "2322 7212 77 4778\r\n", "output": ["1.007209", "1.0072090628", "1.007209062821833"]}, {"input": "9976 9996 4823 4255\r\n", "output": ["0.002203128442388191", "0.002203", "0.0022031284", "0.002203128"]}, {"input": "7631 9769 5377 6437\r\n", "output": ["0.1809717", "0.18097172845776197", "0.1809717285", "0.180972"]}, {"input": "8957 9525 8634 107\r\n", "output": ["0.06498112344125385", "0.06498112", "0.064981", "0.0649811234"]}, {"input": "6612 9565 3380 2288\r\n", "output": ["0.520995", "0.5209951", "0.5209950599858857", "0.5209950600"]}, {"input": "1103 6256 3934 9062\r\n", "output": ["0.39650661742074483", "0.3965066", "0.3965066174", "0.396507"]}, {"input": "1854 3280 1481 2140\r\n", "output": ["0.393814", "0.3938139", "0.3938138636", "0.39381386357359843"]}]
100
100
100
[{'input': '6612 9565 3380 2288\r\n', 'output': ['0.52099505998588567399', '0.52099505998588568900', '0.520995', '0.5209950599858857', '0.520995059986', '0.5209951', '0.5209950600', '0.52099505998588569000']}, {'input': '2255 7902 8891 429\r\n', 'output': ['0.605901', '0.6059012876', '0.605901287553648', '0.6059013']}, {'input': '2 6 2 2\r\n', 'output': ['1.0', '1', '1.000000', '1.0000000000']}, {'input': '7831 8609 6820 2596\r\n', 'output': ['0.082625', '0.08262531860662701784', '0.0826253186', '0.08262531860662701566', '0.08262531860662702', '0.08262531860662701600', '0.0826253186066', '0.0826253']}, {'input': '1 2 123 1\r\n', 'output': ['0.0080645161', '0.008064516129032258', '0.008064516', '0.008065']}]
[{'input': '1854 3280 1481 2140\r\n', 'output': ['0.393814', '0.3938139', '0.39381386357359843000', '0.393813863574', '0.39381386357359843', '0.39381386357359845346', '0.3938138636', '0.39381386357359843275']}, {'input': '4600 9696 5634 8248\r\n', 'output': ['0.36709407866301685000', '0.3670941', '0.367094', '0.36709407866301685397', '0.3670940787', '0.36709407866301685635', '0.367094078663', '0.36709407866301685']}, {'input': '1 10000 1 1\r\n', 'output': ['4999.50000000000000000000', '4999.500000', '4999.5', '4999.5000000', '4999.5000000000']}, {'input': '1 9 1 2\r\n', 'output': ['2.6666666667', '2.6666666666666665', '2.666667']}, {'input': '2 6 2 2\r\n', 'output': ['1.0000000', '1.000000', '1.0', '1.00000000000000000000', '1.0000000000']}]
[{'input': '6745 9881 2149 9907\r\n', 'output': ['0.2601194426011944', '0.2601194426', '0.2601194', '0.260119']}, {'input': '5526 6455 197 4191\r\n', 'output': ['0.2117137648131267', '0.21171376481312670359', '0.2117137648', '0.211713764813', '0.2117138', '0.21171376481312670000', '0.211714', '0.21171376481312670920']}, {'input': '8957 9525 8634 107\r\n', 'output': ['0.06498112344125385', '0.06498112', '0.064981', '0.0649811234']}, {'input': '3274 4728 888 4578\r\n', 'output': ['0.26600804976216613', '0.2660080498', '0.266008']}, {'input': '3381 9769 4898 2532\r\n', 'output': ['0.859757738896', '0.8597577', '0.8597577389', '0.8597577388963661', '0.85975773889636609000', '0.85975773889636608605', '0.859758', '0.85975773889636608344']}]
[{'input': '4400 8021 6895 2089\r\n', 'output': ['0.403049866429', '0.40304986642920748000', '0.40304986642920748174', '0.4030498664292075', '0.40304986642920747995', '0.403050', '0.4030498664', '0.4030499']}, {'input': '8957 9525 8634 107\r\n', 'output': ['0.064981', '0.0649811', '0.06498112344125385', '0.06498112344125385464', '0.06498112344125385500', '0.06498112344125386112', '0.0649811234', '0.0649811234413']}, {'input': '1 9 1 2\r\n', 'output': ['2.6666666667', '2.6666666666666665', '2.666667']}, {'input': '9999 10000 10000 10000\r\n', 'output': ['0.000050', '0.0000500000', '0.00005000000000000000', '0.0000500', '5.0E-5', '5e-05']}, {'input': '3274 4728 888 4578\r\n', 'output': ['0.2660080', '0.26600804976216613', '0.2660080498', '0.26600804976216613218', '0.266008049762', '0.26600804976216611781', '0.266008', '0.26600804976216613000']}]
[{'input': '1 10000 1 1\r\n', 'output': ['4999.50000000000000000000', '4999.500000', '4999.5', '4999.5000000', '4999.5000000000']}, {'input': '1 9 1 2\r\n', 'output': ['2.66666666666666666674', '2.66666666667', '2.6666666666666665', '2.6666667', '2.66666666666666650000', '2.666667', '2.6666666667', '2.66666666666666651864']}, {'input': '5526 6455 197 4191\r\n', 'output': ['0.2117137648131267', '0.21171376481312670359', '0.2117137648', '0.211713764813', '0.2117138', '0.21171376481312670000', '0.211714', '0.21171376481312670920']}, {'input': '5726 9082 7448 3054\r\n', 'output': ['0.31955817939440107', '0.319558', '0.3195581794', '0.3195582']}, {'input': '1036 6259 5451 4713\r\n', 'output': ['0.51387249114521838000', '0.513872', '0.5138724911', '0.5138724911452184', '0.51387249114521837967', '0.51387249114521841794', '0.513872491145', '0.5138725']}]
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
4
100
100
100
["2"]
The only line of the input contains a single integer n (2 ≀ n ≀ 2Β·1018) β€” the power in which you need to raise number 5.
dcaff75492eafaf61d598779d6202c9d
#include <stdio.h> #include <math.h> int main(){ int i; scanf("%d",&i); printf("25"); return 0; }
["25"]
C
null
Output the last two digits of 5n without spaces between them.
The HR manager was disappointed again. The last applicant failed the interview the same way as 24 previous ones. "Do I give such a hard task?" β€” the HR manager thought. "Just raise number 5 to the power of n and get last two digits of the number. Yes, of course, n can be rather big, and one cannot find the power using a calculator, but we need people who are able to think, not just follow the instructions."Could you pass the interview in the machine vision company in IT City?
[{"input": "2\r\n", "output": ["25"]}, {"input": "7\r\n", "output": ["25"]}, {"input": "1000000000000000000\r\n", "output": ["25"]}, {"input": "2000000000000000000\r\n", "output": ["25"]}, {"input": "987654321012345678\r\n", "output": ["25"]}]
100
100
100
[{'input': '7\r\n', 'output': ['25']}, {'input': '2000000000000000000\r\n', 'output': ['25']}, {'input': '987654321012345678\r\n', 'output': ['25']}, {'input': '2\r\n', 'output': ['25']}, {'input': '1000000000000000000\r\n', 'output': ['25']}]
[{'input': '1000000000000000000\r\n', 'output': ['25']}, {'input': '7\r\n', 'output': ['25']}, {'input': '987654321012345678\r\n', 'output': ['25']}, {'input': '2000000000000000000\r\n', 'output': ['25']}, {'input': '2\r\n', 'output': ['25']}]
[{'input': '1000000000000000000\r\n', 'output': ['25']}, {'input': '2000000000000000000\r\n', 'output': ['25']}, {'input': '2\r\n', 'output': ['25']}, {'input': '987654321012345678\r\n', 'output': ['25']}, {'input': '7\r\n', 'output': ['25']}]
[{'input': '7\r\n', 'output': ['25']}, {'input': '1000000000000000000\r\n', 'output': ['25']}, {'input': '2000000000000000000\r\n', 'output': ['25']}, {'input': '987654321012345678\r\n', 'output': ['25']}, {'input': '2\r\n', 'output': ['25']}]
[{'input': '987654321012345678\r\n', 'output': ['25']}, {'input': '7\r\n', 'output': ['25']}, {'input': '2\r\n', 'output': ['25']}, {'input': '2000000000000000000\r\n', 'output': ['25']}, {'input': '1000000000000000000\r\n', 'output': ['25']}]
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
5
100
100
100
["5\n()))()", "3\n(()", "2\n((("]
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) β€” the half-length of the resulting regular bracket sequences (the resulting sequences must have length equal to $$$2n$$$). The second line of the input contains one string $$$s$$$ ($$$1 \le |s| \le 200$$$) β€” the string $$$s$$$ that should be a substring in each of the resulting regular bracket sequences ($$$|s|$$$ is the length of $$$s$$$).
590a49a7af0eb83376ed911ed488d7e5
#include <stdio.h> #include <string.h> enum { BIG = 1000000007 }; int n; char s[240]; int slen; int dp[201][101]; int next[201][2]; int fail[201]; void nextstep(int eo) { int i, j; for (i = 0; i <= slen; i++) { int lp = next[i][0]; int rp = next[i][1]; for (j = eo; j <= n; j+=2) { int now = dp[i][j]; if (j < n) { int add = dp[lp][j+1] + now; dp[lp][j+1] = add < BIG ? add : add - BIG; } if (j > 0) { int add = dp[rp][j-1] + now; dp[rp][j-1] = add < BIG ? add : add - BIG; } } } for (i = 0; i <= slen; i++) { for (j = eo; j <= n; j+=2) { dp[i][j] = 0; } } /*for (i=0;i<=slen;i++){ for (j=0;j<=n;j++){ printf("%3d,",dp[i][j]); } puts(""); } puts("");*/ } int main() { scanf("%d", &n); scanf(" %202s", s); slen = strlen(s); int i; // build state machine fail[0] = fail[1] = 0; if (s[0] == '(') { next[0][0] = 1; next[0][1] = 0; } else { next[0][0] = 0; next[0][1] = 1; } for (i = 1; i < slen; i++) { int r = s[i] == ')'; int f = fail[i]; next[i][r] = i+1; next[i][1-r] = next[f][1-r]; fail[i+1] = next[f][r]; } next[slen][0] = next[slen][1] = slen; dp[0][0] = 1; for (i = 0; i < n; i++) { nextstep(0); nextstep(1); } printf("%d\n", dp[slen][0]); return 0; }
["5", "4", "0"]
C
NoteAll regular bracket sequences satisfying the conditions above for the first example: "(((()))())"; "((()()))()"; "((()))()()"; "(()(()))()"; "()((()))()". All regular bracket sequences satisfying the conditions above for the second example: "((()))"; "(()())"; "(())()"; "()(())". And there is no regular bracket sequences of length $$$4$$$ containing "(((" as a substring in the third example.
Print only one integer β€” the number of regular bracket sequences containing the given bracket sequence $$$s$$$ as a substring. Since this number can be huge, print it modulo $$$10^9+7$$$ ($$$1000000007$$$).
You are given a bracket sequence $$$s$$$ (not necessarily a regular one). A bracket sequence is a string containing only characters '(' and ')'.A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters '1' and '+' between the original characters of the sequence. For example, bracket sequences "()()" and "(())" are regular (the resulting expressions are: "(1)+(1)" and "((1+1)+1)"), and ")(", "(" and ")" are not.Your problem is to calculate the number of regular bracket sequences of length $$$2n$$$ containing the given bracket sequence $$$s$$$ as a substring (consecutive sequence of characters) modulo $$$10^9+7$$$ ($$$1000000007$$$).
[{"input": "5\r\n()))()\r\n", "output": ["5"]}, {"input": "3\r\n(()\r\n", "output": ["4"]}, {"input": "2\r\n(((\r\n", "output": ["0"]}, {"input": "100\r\n()(()))))(()((((()())()))(()))()()))(((()))))))))(\r\n", "output": ["979898526"]}, {"input": "100\r\n()(()(()((()(()(()()()(()((()))())())))()))())()()\r\n", "output": ["711757760"]}, {"input": "100\r\n(()))(()())()()((())(()((()()))(())()(((((()(((()()))())))))(())((((()()()()()))(()))(())(())(()))((\r\n", "output": ["599470552"]}, {"input": "100\r\n(()(()()()()(()(()()(((()((()(((()(((()(()()((()())))))()()()))))()()())))()()))()))()()()()())()())\r\n", "output": ["812513651"]}, {"input": "100\r\n(()))()())((())))((((())()((())(()(())))(()()(((()()())())()()(())))())((((()())(())())((((()((()((()()(())))(())))))()(()))))())()()))))()(()(()())((\r\n", "output": ["657505568"]}, {"input": "100\r\n()()()(((((()(()((((()((((((()()()((()()(()()()(((()()((()()((()()()))()()()))()))))())()())()()()())()()()())())())))())()())())))())()))))()()()()()\r\n", "output": ["264738339"]}, {"input": "100\r\n()()))(()()))))((()()))))(()()(()())()))))()())()()((((()(()()((())))((()()())())(())((()((()))(((()(()))))))())))((((()())))(()(()(())))(()))()()())((())()((())(()(((()((())))())))()()()((()))()()())\r\n", "output": ["0"]}, {"input": "100\r\n(()(()()()((()((((((()(()()((((()()((((()((()()((()((()()(()(((()((()()()()(()((()()(((()()(()((()()))())()))())()()()()())))())())()))()))()()))))()))()))))))())())()())))())))())))()()()())()())()()\r\n", "output": ["1"]}, {"input": "100\r\n()\r\n", "output": ["558488487"]}, {"input": "100\r\n()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()\r\n", "output": ["1"]}, {"input": "100\r\n(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((())))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))\r\n", "output": ["1"]}, {"input": "100\r\n()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()\r\n", "output": ["2"]}, {"input": "100\r\n((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((()))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))\r\n", "output": ["3"]}, {"input": "100\r\n)\r\n", "output": ["558488487"]}, {"input": "100\r\n))\r\n", "output": ["558488486"]}, {"input": "100\r\n))())())()))()())())()(((((((()()))())()())()(((()()))(())()((((()()()())()((()()()())()(((((()()()(()(()()((((()())))()))()(())(())))))))))((()((()())())(()((())((())()(()(()\r\n", "output": ["325"]}, {"input": "100\r\n()())(((()((())))((())((()(())))(((((((()))))))()(()((()()(((())))())()((((())()(())))(((((()))())(()))))((()))((())()(((())((()())(()(()))((()()()())())())))(()()()))()))))())))))))()(\r\n", "output": ["1820"]}, {"input": "100\r\n()(()())()(())))()())()(())((()(()()((()((((((())()))(()(()()))(()()())((()())))())())))())))(())(()()))(((())))(((((())(())(()))((())(())))())))()))()((())()()())()))(()())(()(()))(()(())))\r\n", "output": ["1"]}, {"input": "12\r\n()()()\r\n", "output": ["62316"]}, {"input": "20\r\n()(()()())\r\n", "output": ["296672330"]}, {"input": "32\r\n()((()()()())())\r\n", "output": ["468509380"]}, {"input": "50\r\n(\r\n", "output": ["265470434"]}, {"input": "10\r\n)()))())))())(())(()(((())(()))))))(()())))))))(((\r\n", "output": ["0"]}, {"input": "20\r\n))()))(()()))(())()))()(((((((((()((())((((((())(())(()())))(()()((())(()()()()(()())()()))))))())((\r\n", "output": ["0"]}, {"input": "1\r\n(\r\n", "output": ["1"]}, {"input": "2\r\n)\r\n", "output": ["2"]}, {"input": "3\r\n)\r\n", "output": ["5"]}, {"input": "4\r\n(\r\n", "output": ["14"]}, {"input": "5\r\n(\r\n", "output": ["42"]}, {"input": "6\r\n)\r\n", "output": ["132"]}, {"input": "7\r\n)\r\n", "output": ["429"]}, {"input": "8\r\n(\r\n", "output": ["1430"]}, {"input": "9\r\n(\r\n", "output": ["4862"]}, {"input": "10\r\n)\r\n", "output": ["16796"]}, {"input": "11\r\n(\r\n", "output": ["58786"]}, {"input": "12\r\n(\r\n", "output": ["208012"]}, {"input": "13\r\n)\r\n", "output": ["742900"]}, {"input": "14\r\n)\r\n", "output": ["2674440"]}, {"input": "15\r\n(\r\n", "output": ["9694845"]}, {"input": "16\r\n(\r\n", "output": ["35357670"]}, {"input": "17\r\n)\r\n", "output": ["129644790"]}, {"input": "18\r\n)\r\n", "output": ["477638700"]}, {"input": "19\r\n(\r\n", "output": ["767263183"]}, {"input": "20\r\n)\r\n", "output": ["564120378"]}, {"input": "21\r\n(\r\n", "output": ["466266852"]}, {"input": "22\r\n(\r\n", "output": ["482563003"]}, {"input": "23\r\n)\r\n", "output": ["59611249"]}, {"input": "1\r\n(((\r\n", "output": ["0"]}, {"input": "100\r\n((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((\r\n", "output": ["0"]}]
100
100
100
[{'input': '20\r\n()(()()())\r\n', 'output': ['296672330']}, {'input': '100\r\n()()()(((((()(()((((()((((((()()()((()()(()()()(((()()((()()((()()()))()()()))()))))())()())()()()())()()()())())())))())()())())))())()))))()()()()()\r\n', 'output': ['264738339']}, {'input': '100\r\n()(()())()(())))()())()(())((()(()()((()((((((())()))(()(()()))(()()())((()())))())())))())))(())(()()))(((())))(((((())(())(()))((())(())))())))()))()((())()()())()))(()())(()(()))(()(())))\r\n', 'output': ['1']}, {'input': '1\r\n(\r\n', 'output': ['1']}, {'input': '22\r\n(\r\n', 'output': ['482563003']}]
[{'input': '100\r\n(()))(()())()()((())(()((()()))(())()(((((()(((()()))())))))(())((((()()()()()))(()))(())(())(()))((\r\n', 'output': ['599470552']}, {'input': '20\r\n()(()()())\r\n', 'output': ['296672330']}, {'input': '1\r\n(((\r\n', 'output': ['0']}, {'input': '8\r\n(\r\n', 'output': ['1430']}, {'input': '100\r\n()(()(()((()(()(()()()(()((()))())())))()))())()()\r\n', 'output': ['711757760']}]
[{'input': '18\r\n)\r\n', 'output': ['477638700']}, {'input': '2\r\n)\r\n', 'output': ['2']}, {'input': '20\r\n()(()()())\r\n', 'output': ['296672330']}, {'input': '14\r\n)\r\n', 'output': ['2674440']}, {'input': '15\r\n(\r\n', 'output': ['9694845']}]
[{'input': '100\r\n))\r\n', 'output': ['558488486']}, {'input': '100\r\n()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()\r\n', 'output': ['1']}, {'input': '100\r\n()(()))))(()((((()())()))(()))()()))(((()))))))))(\r\n', 'output': ['979898526']}, {'input': '2\r\n(((\r\n', 'output': ['0']}, {'input': '100\r\n()()))(()()))))((()()))))(()()(()())()))))()())()()((((()(()()((())))((()()())())(())((()((()))(((()(()))))))())))((((()())))(()(()(())))(()))()()())((())()((())(()(((()((())))())))()()()((()))()()())\r\n', 'output': ['0']}]
[{'input': '100\r\n()(()(()((()(()(()()()(()((()))())())))()))())()()\r\n', 'output': ['711757760']}, {'input': '32\r\n()((()()()())())\r\n', 'output': ['468509380']}, {'input': '100\r\n((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((\r\n', 'output': ['0']}, {'input': '3\r\n)\r\n', 'output': ['5']}, {'input': '10\r\n)\r\n', 'output': ['16796']}]
100
100
100
100
100
94.87
94.87
100
100
100
95.45
95.45
100
100
100
6
100
97.948
98.18
["8 1 1", "8 1 10"]
The only line contains three integers n, x and y (1 ≀ n ≀ 107, 1 ≀ x, y ≀ 109) β€” the number of letters 'a' in the input file and the parameters from the problem statement.
0f270af00be2a523515d5e7bd66800f6
#include<stdio.h> #include<stdlib.h> int main() { unsigned long long n, x, y; unsigned long nl, xl, yl; fscanf(stdin, "%ld %ld %ld", &nl, &xl, &yl); n = (unsigned long long)nl; x = (unsigned long long)xl; y = (unsigned long long)yl; unsigned long long* f = malloc(10000001*sizeof(unsigned long long)); f[1] = x; f[2] = x < y? x + f[1] : y + f[1]; unsigned long long k; for (unsigned long long m = 3; m < n+1; m++) { k = (m+1)/2; if (m % 2 == 1) f[2*k-1] = f[k]+y+x < f[2*k-2]+x ? f[k]+y+x : f[2*k-2]+x; else f[2*k] = f[k]+y < f[2*k-2]+2*x ? f[k]+y : f[2*k-2]+2*x; } unsigned long pref = f[n] / 1000000000Lu; unsigned long rest = f[n] % 1000000000Lu; int digs = 9; int pow10 = 100000000Lu; while (digs > 1) { if (rest >= pow10) break; pow10 /= 10; digs = digs-1; } if (pref > 0) { if (9-digs == 0) printf("%lu%lu\n", pref, rest); else { char* zeros = malloc((9-digs+1)*sizeof(char)); for (int i = 0; i < 9-digs; i++) zeros[i] = '0'; zeros[9-digs] = 0; printf("%lu%s%lu\n", pref, zeros, rest); } } else printf("%lu\n", rest); }
["4", "8"]
C
null
Print the only integer t β€” the minimum amount of time needed to generate the input file.
zscoder wants to generate an input file for some programming competition problem.His input is a string consisting of n letters 'a'. He is too lazy to write a generator so he will manually generate the input in a text editor.Initially, the text editor is empty. It takes him x seconds to insert or delete a letter 'a' from the text file and y seconds to copy the contents of the entire text file, and duplicate it.zscoder wants to find the minimum amount of time needed for him to create the input file of exactly n letters 'a'. Help him to determine the amount of time needed to generate the input.
[{"input": "8 1 1\r\n", "output": ["4"]}, {"input": "8 1 10\r\n", "output": ["8"]}, {"input": "10 62 99\r\n", "output": ["384"]}, {"input": "88 417 591\r\n", "output": ["4623"]}, {"input": "57 5289 8444\r\n", "output": ["60221"]}, {"input": "382 81437847 324871127\r\n", "output": ["2519291691"]}, {"input": "244 575154303 436759189\r\n", "output": ["5219536421"]}, {"input": "85 902510038 553915152\r\n", "output": ["6933531064"]}, {"input": "1926 84641582 820814219\r\n", "output": ["7184606427"]}, {"input": "3768 561740421 232937477\r\n", "output": ["5042211408"]}, {"input": "2313 184063453 204869248\r\n", "output": ["2969009745"]}, {"input": "35896 278270961 253614967\r\n", "output": ["5195579310"]}, {"input": "483867 138842067 556741142\r\n", "output": ["10712805143"]}, {"input": "4528217 187553422 956731625\r\n", "output": ["21178755627"]}, {"input": "10000000 1000000000 1\r\n", "output": ["8000000023"]}, {"input": "10000000 1 100\r\n", "output": ["1757"]}, {"input": "10000000 1 1000000000\r\n", "output": ["10000000"]}, {"input": "10000000 1 1000\r\n", "output": ["14224"]}, {"input": "10000000 1 10\r\n", "output": ["214"]}, {"input": "1 1 1\r\n", "output": ["1"]}, {"input": "10000000 998 998\r\n", "output": ["30938"]}, {"input": "9999999 987654321 123456789\r\n", "output": ["11728395036"]}, {"input": "9999999 1 2\r\n", "output": ["54"]}, {"input": "10000000 1 1\r\n", "output": ["31"]}, {"input": "11478 29358 26962\r\n", "output": ["556012"]}, {"input": "4314870 1000000000 1\r\n", "output": ["7000000022"]}, {"input": "7186329 608148870 290497442\r\n", "output": ["12762929866"]}, {"input": "9917781 1 1\r\n", "output": ["35"]}, {"input": "7789084 807239576 813643932\r\n", "output": ["25165322688"]}, {"input": "58087 1 100000000\r\n", "output": ["58087"]}, {"input": "9999991 2 3\r\n", "output": ["88"]}]
100
100
100
[{'input': '11478 29358 26962\r\n', 'output': ['556012']}, {'input': '57 5289 8444\r\n', 'output': ['60221']}, {'input': '382 81437847 324871127\r\n', 'output': ['2519291691']}, {'input': '10000000 1 100\r\n', 'output': ['1757']}, {'input': '10000000 998 998\r\n', 'output': ['30938']}]
[{'input': '9917781 1 1\r\n', 'output': ['35']}, {'input': '382 81437847 324871127\r\n', 'output': ['2519291691']}, {'input': '85 902510038 553915152\r\n', 'output': ['6933531064']}, {'input': '8 1 10\r\n', 'output': ['8']}, {'input': '10000000 1 1000000000\r\n', 'output': ['10000000']}]
[{'input': '7186329 608148870 290497442\r\n', 'output': ['12762929866']}, {'input': '4528217 187553422 956731625\r\n', 'output': ['21178755627']}, {'input': '9999999 1 2\r\n', 'output': ['54']}, {'input': '88 417 591\r\n', 'output': ['4623']}, {'input': '1926 84641582 820814219\r\n', 'output': ['7184606427']}]
[{'input': '483867 138842067 556741142\r\n', 'output': ['10712805143']}, {'input': '8 1 10\r\n', 'output': ['8']}, {'input': '10000000 1 1000\r\n', 'output': ['14224']}, {'input': '4314870 1000000000 1\r\n', 'output': ['7000000022']}, {'input': '9917781 1 1\r\n', 'output': ['35']}]
[{'input': '483867 138842067 556741142\r\n', 'output': ['10712805143']}, {'input': '10000000 1 10\r\n', 'output': ['214']}, {'input': '85 902510038 553915152\r\n', 'output': ['6933531064']}, {'input': '3768 561740421 232937477\r\n', 'output': ['5042211408']}, {'input': '10000000 1 1\r\n', 'output': ['31']}]
100
100
100
100
100
86.67
86.67
86.67
100
100
75
81.25
75
100
93.75
7
100
92.002
85
["047", "16", "472747"]
The single line contains a non-empty string s whose length can range from 1 to 50, inclusive. The string only contains digits. The string can contain leading zeroes.
639b8b8d0dc42df46b139f0aeb3a7a0a
#include <stdio.h> # include <string.h> int main() { char ch[100]; scanf("%s",&ch); int i,c1=0,c2=0; for(i=0;i<strlen(ch);i++) { if(ch[i]==4+48) c1++; else if(ch[i]==7+48) c2++; } if(c1==0 && c2==0) printf("-1\n"); else if(c1>=c2) printf("4\n"); else printf("7\n"); return 0; }
["4", "-1", "7"]
C
NoteThe lexicographical comparison of strings is performed by the &lt; operator in the modern programming languages. String x is lexicographically less than string y either if x is a prefix of y, or exists such i (1 ≀ i ≀ min(|x|, |y|)), that xi &lt; yi and for any j (1 ≀ j &lt; i) xj = yj. Here |a| denotes the length of string a.In the first sample three conditions are fulfilled for strings "4", "7" and "47". The lexicographically minimum one is "4".In the second sample s has no substrings which are lucky numbers.In the third sample the three conditions are only fulfilled for string "7".
In the only line print the answer to Petya's problem. If the sought string does not exist, print "-1" (without quotes).
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.One day Petya was delivered a string s, containing only digits. He needs to find a string that represents a lucky number without leading zeroes, is not empty, is contained in s as a substring the maximum number of times.Among all the strings for which the three conditions given above are fulfilled, Petya only needs the lexicographically minimum one. Find this string for Petya.
[{"input": "047\r\n", "output": ["4"]}, {"input": "16\r\n", "output": ["-1"]}, {"input": "472747\r\n", "output": ["7"]}, {"input": "1925\r\n", "output": ["-1"]}, {"input": "5486846414848445484\r\n", "output": ["4"]}, {"input": "516160414\r\n", "output": ["4"]}, {"input": "9458569865994896\r\n", "output": ["4"]}, {"input": "94894948577777777884888\r\n", "output": ["7"]}, {"input": "00000\r\n", "output": ["-1"]}, {"input": "9589\r\n", "output": ["-1"]}, {"input": "7665711\r\n", "output": ["7"]}, {"input": "538772857\r\n", "output": ["7"]}, {"input": "8679647744\r\n", "output": ["4"]}, {"input": "23607019991994\r\n", "output": ["4"]}, {"input": "86145305734278927901987281894864719533015270066521\r\n", "output": ["7"]}, {"input": "22438808523154336905543301642540261833729318191\r\n", "output": ["4"]}, {"input": "290732082244359495795943967215788554387079\r\n", "output": ["7"]}, {"input": "6363333480463521971676988087733137609715\r\n", "output": ["7"]}, {"input": "637789221789855555993957058\r\n", "output": ["7"]}, {"input": "11536708648794535307468278326553811\r\n", "output": ["7"]}, {"input": "619433861636130069773\r\n", "output": ["7"]}, {"input": "7\r\n", "output": ["7"]}, {"input": "00000000000000000000000000000000000000000000000000\r\n", "output": ["-1"]}, {"input": "0000000000000000000000000000000000000047\r\n", "output": ["4"]}, {"input": "8175012266795100056032281135654854227489558885698\r\n", "output": ["4"]}, {"input": "8862708665262955384044574268728167940741129\r\n", "output": ["4"]}, {"input": "538772857\r\n", "output": ["7"]}, {"input": "94872076199824813574576121510803\r\n", "output": ["7"]}, {"input": "44101164480392494025995467\r\n", "output": ["4"]}, {"input": "0445460407410702955646485\r\n", "output": ["4"]}, {"input": "91076008557028243309\r\n", "output": ["7"]}, {"input": "33120039\r\n", "output": ["-1"]}, {"input": "4\r\n", "output": ["4"]}, {"input": "74747474747474747474747474747474747474747474747474\r\n", "output": ["4"]}, {"input": "74747474747474747474747774747474747474747474747474\r\n", "output": ["7"]}, {"input": "74747474747474747474747474747474744474747474747474\r\n", "output": ["4"]}, {"input": "47474747474747474747474747474747474747474747474747\r\n", "output": ["4"]}, {"input": "40\r\n", "output": ["4"]}, {"input": "07\r\n", "output": ["7"]}, {"input": "007\r\n", "output": ["7"]}, {"input": "44\r\n", "output": ["4"]}, {"input": "74\r\n", "output": ["4"]}]
100
100
100
[{'input': '74747474747474747474747474747474747474747474747474\r\n', 'output': ['4']}, {'input': '290732082244359495795943967215788554387079\r\n', 'output': ['7']}, {'input': '0000000000000000000000000000000000000047\r\n', 'output': ['4']}, {'input': '00000000000000000000000000000000000000000000000000\r\n', 'output': ['-1']}, {'input': '91076008557028243309\r\n', 'output': ['7']}]
[{'input': '40\r\n', 'output': ['4']}, {'input': '047\r\n', 'output': ['4']}, {'input': '637789221789855555993957058\r\n', 'output': ['7']}, {'input': '44\r\n', 'output': ['4']}, {'input': '0445460407410702955646485\r\n', 'output': ['4']}]
[{'input': '9589\r\n', 'output': ['-1']}, {'input': '74747474747474747474747474747474747474747474747474\r\n', 'output': ['4']}, {'input': '44101164480392494025995467\r\n', 'output': ['4']}, {'input': '0445460407410702955646485\r\n', 'output': ['4']}, {'input': '5486846414848445484\r\n', 'output': ['4']}]
[{'input': '0445460407410702955646485\r\n', 'output': ['4']}, {'input': '538772857\r\n', 'output': ['7']}, {'input': '472747\r\n', 'output': ['7']}, {'input': '11536708648794535307468278326553811\r\n', 'output': ['7']}, {'input': '637789221789855555993957058\r\n', 'output': ['7']}]
[{'input': '07\r\n', 'output': ['7']}, {'input': '538772857\r\n', 'output': ['7']}, {'input': '74\r\n', 'output': ['4']}, {'input': '637789221789855555993957058\r\n', 'output': ['7']}, {'input': '23607019991994\r\n', 'output': ['4']}]
100
100
100
100
100
100
92.86
92.86
92.86
92.86
91.67
91.67
83.33
91.67
91.67
8
100
94.288
90.002
["2 2\nRU", "1 2\nRU", "-1 1000000000\nLRRLU", "0 0\nD"]
The first line contains two integers a and b, ( - 109 ≀ a, b ≀ 109). The second line contains a string s (1 ≀ |s| ≀ 100, s only contains characters 'U', 'D', 'L', 'R') β€” the command.
5d6212e28c7942e9ff4d096938b782bf
#include <stdio.h> #include <string.h> int a,b,l; int x,y,xl,yl; char s[105]; int w[105][2]; int al,bl; int p(int a1,int b1,int x1,int y1) { if ((a1<0&&x1>0)||(a1>0&&x1<0))return 0; if ((b1<0&&y1>0)||(b1>0&&y1<0))return 0; return 1; } int main() { int i,j; scanf ("%d%d",&a,&b); scanf ("%s",s);l=strlen(s); if (a==0&&b==0){printf ("Yes\n");return 0;} for (i=0;i<l;i++) { if (s[i]=='U'){w[i+1][0]=0;w[i+1][1]=1;} if (s[i]=='D'){w[i+1][0]=0;w[i+1][1]=-1;} if (s[i]=='L'){w[i+1][0]=-1;w[i+1][1]=0;} if (s[i]=='R'){w[i+1][0]=1;w[i+1][1]=0;} } for (i=0;i<=l;i++) { xl+=w[i][0];yl+=w[i][1]; } //printf ("{{%d %d}}\n",xl,yl); for (i=0;i<=l;i++) { x+=w[i][0];y+=w[i][1]; al=a-x;bl=b-y;//printf ("(%d %d)<%d,%d>\n",al,bl,x,y); if (!p(al,bl,xl,yl))continue; if (al==0&&bl==0) {printf ("Yes\n");return 0;} if (al==0) {if (xl==0&&yl!=0&&bl%yl==0) {printf ("Yes\n");return 0;}else continue;} if (bl==0) {if (yl==0&&xl!=0&&al%xl==0) {printf ("Yes\n");return 0;}else continue;} if (xl!=0&&yl!=0&&al%xl==0&&bl%yl==0&&al/xl==bl/yl){printf ("Yes\n");return 0;} } printf ("No\n"); return 0; }
["Yes", "No", "Yes", "Yes"]
C
NoteIn the first and second test case, command string is "RU", so the robot will go right, then go up, then right, and then up and so on.The locations of its moves are (0, 0)  →  (1, 0)  →  (1, 1)  →  (2, 1)  →  (2, 2)  →  ...So it can reach (2, 2) but not (1, 2).
Print "Yes" if the robot will be located at (a, b), and "No" otherwise.
Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string s. Each character of s is one move operation. There are four move operations at all: 'U': go up, (x, y)  →  (x, y+1); 'D': go down, (x, y)  →  (x, y-1); 'L': go left, (x, y)  →  (x-1, y); 'R': go right, (x, y)  →  (x+1, y). The robot will do the operations in s from left to right, and repeat it infinite times. Help Fox Ciel to determine if after some steps the robot will located in (a, b).
[{"input": "2 2\r\nRU\r\n", "output": ["Yes"]}, {"input": "1 2\r\nRU\r\n", "output": ["No"]}, {"input": "-1 1000000000\r\nLRRLU\r\n", "output": ["Yes"]}, {"input": "0 0\r\nD\r\n", "output": ["Yes"]}, {"input": "0 0\r\nUURRDL\r\n", "output": ["Yes"]}, {"input": "987654321 987654321\r\nUURRDL\r\n", "output": ["Yes"]}, {"input": "4 2\r\nUURRDL\r\n", "output": ["No"]}, {"input": "4 3\r\nUURRDL\r\n", "output": ["Yes"]}, {"input": "4 4\r\nUURRDL\r\n", "output": ["Yes"]}, {"input": "4 6\r\nUURRDL\r\n", "output": ["Yes"]}, {"input": "4 7\r\nUURRDL\r\n", "output": ["No"]}, {"input": "1000000000 1000000000\r\nUURRDL\r\n", "output": ["Yes"]}, {"input": "-1 -1\r\nUR\r\n", "output": ["No"]}, {"input": "1 1\r\nUURRDDLL\r\n", "output": ["No"]}, {"input": "987654321 2\r\nUURDD\r\n", "output": ["Yes"]}, {"input": "0 123456789\r\nRRULL\r\n", "output": ["Yes"]}, {"input": "4 4\r\nUUUURRRRDDDDLLLL\r\n", "output": ["Yes"]}, {"input": "-491226083 -49122610\r\nUDRLDURLDLLLDUDURLRDUUDDUUULUDRDRDUULURDRLLDDDLUDUURLUUDLLDULLLLDDLDDUU\r\n", "output": ["Yes"]}, {"input": "-261597957 418556728\r\nLLLDLUDUULLRDDULLRRUDRDLULRLRLLRRUUDRRLRUDLRRLUDRDLLUUDUULRURLDLULUUULDDUURLRUDURRL\r\n", "output": ["Yes"]}, {"input": "-771928144 -3\r\nRUDULULDRDLLLULDDUDDDDUDULRULRUULDDDURUDLUURULLLDLLDDRDDRLRURUULRUURRUDLDLDDRLLULRRDRRLLUULUDRUUDRRD\r\n", "output": ["Yes"]}, {"input": "397346346 1\r\nDDURRUURLDLRRLULD\r\n", "output": ["Yes"]}, {"input": "-528551525 0\r\nUDRLRRLDLDLURRRRULDLRLRLURUUDDLRLLDRRULLUDLURDLUUULLLRUUUDRRURLDUDULDDRDDDRDL\r\n", "output": ["Yes"]}, {"input": "311692421 -129871846\r\nLLLDURULDDDDUDDURRLUUDRLDDRDURDDRUDUURLUDUDLDRUDDDUUURDRRUDRDRDURLLDURUUDRLDLDURRRRRRDULURDRU\r\n", "output": ["Yes"]}, {"input": "485940814 728911221\r\nURURU\r\n", "output": ["Yes"]}, {"input": "-843450986 632588242\r\nLURLULULRUDUDULRDDLUL\r\n", "output": ["Yes"]}, {"input": "647999516 -809999401\r\nUDLDDLLULUDDLLDUULRRRDLUDDLDDLRLRRDRURURDRRDRULUDRDULRULLRRLLDDRLRRUDRURDUULUDLRRLRDR\r\n", "output": ["Yes"]}, {"input": "352820537 -764444491\r\nRDDUDLUDDUDLRRRDRRRDRRDUDUDDURLRRLDRLLRLLLLUULUDRURRDRLDDLLDRDURDUDRUDDLUDRLURUDRURDRDDLDRLDLDLLU\r\n", "output": ["Yes"]}, {"input": "-284973644 -1\r\nDLULLDLRUUDRR\r\n", "output": ["Yes"]}, {"input": "356922591 -2\r\nRRLDLDUDRUUUULUUDDULDDUDD\r\n", "output": ["No"]}, {"input": "27033101 54066203\r\nUDDDRDLLLRUUDDLRDLDRLRUDDULRLLRULR\r\n", "output": ["No"]}, {"input": "-199335150 39867031\r\nLLURRDUULRUDDRDUUULDLDRDDLURDRLDRLLLRRRRRULRRRUUDD\r\n", "output": ["No"]}, {"input": "609504072 609504074\r\nULRLUDLDDR\r\n", "output": ["No"]}, {"input": "497684357 829473929\r\nRRLDUUURULURRLLRRLRLURRLDU\r\n", "output": ["Yes"]}, {"input": "551922835 183974295\r\nDUDUUULDRLRURRDULRRUDDLRLLUULLRLRDRDRR\r\n", "output": ["No"]}, {"input": "825368095 -825368096\r\nRD\r\n", "output": ["No"]}, {"input": "-458990423 -229495204\r\nDLLDDRLUDLRLUL\r\n", "output": ["No"]}, {"input": "285102789 570205594\r\nRRDULRULULRRDUURRLURUDDULLRDUL\r\n", "output": ["No"]}, {"input": "109928480 219856920\r\nLRURLRLURDRDLDRDLRDDUUDDLULDRRUUURRUDLLUULUUUR\r\n", "output": ["No"]}, {"input": "-532674020 532674026\r\nUURLLL\r\n", "output": ["No"]}, {"input": "999999999 0\r\nRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\r\n", "output": ["Yes"]}, {"input": "0 0\r\nUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLR\r\n", "output": ["Yes"]}, {"input": "1 1\r\nUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLRUDLR\r\n", "output": ["No"]}, {"input": "-1000000000 -1000000000\r\nDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDL\r\n", "output": ["Yes"]}, {"input": "3 3\r\nUURR\r\n", "output": ["No"]}, {"input": "-2 -2\r\nUR\r\n", "output": ["No"]}, {"input": "5 5\r\nUDLR\r\n", "output": ["No"]}, {"input": "0 -1\r\nU\r\n", "output": ["No"]}, {"input": "-1 0\r\nR\r\n", "output": ["No"]}, {"input": "1000000000 1000000000\r\nURURURUR\r\n", "output": ["Yes"]}, {"input": "-1 -1\r\nRU\r\n", "output": ["No"]}, {"input": "1 1\r\nLD\r\n", "output": ["No"]}, {"input": "-2 -2\r\nUURR\r\n", "output": ["No"]}, {"input": "1000000000 0\r\nRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\r\n", "output": ["Yes"]}, {"input": "2 6\r\nRUUUURLDDDL\r\n", "output": ["Yes"]}, {"input": "0 1\r\nLUUR\r\n", "output": ["No"]}, {"input": "1 1\r\nURDLDL\r\n", "output": ["Yes"]}, {"input": "-10 -10\r\nRU\r\n", "output": ["No"]}, {"input": "1000000000 1000000000\r\nRURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURU\r\n", "output": ["Yes"]}, {"input": "-1000000000 -500000000\r\nURR\r\n", "output": ["No"]}, {"input": "-2 0\r\nULLLDDRRRR\r\n", "output": ["Yes"]}, {"input": "999999999 -999999999\r\nRRRRRRRRRRRRRRRRRRRRRRRRRDDDDDDDDDDDDDDDDDDDDDDDDDLLLLLLLLLLLLLLLLLLLLLLLUUUUUUUUUUUUUUUUUUUUUUU\r\n", "output": ["Yes"]}, {"input": "-100 -100\r\nRU\r\n", "output": ["No"]}, {"input": "100 100\r\nRUL\r\n", "output": ["No"]}, {"input": "0 1\r\nUDLR\r\n", "output": ["Yes"]}, {"input": "0 1\r\nD\r\n", "output": ["No"]}, {"input": "0 -3\r\nRDDL\r\n", "output": ["No"]}]
100
100
100
[{'input': '485940814 728911221\r\nURURU\r\n', 'output': ['Yes']}, {'input': '1000000000 1000000000\r\nUURRDL\r\n', 'output': ['Yes']}, {'input': '-261597957 418556728\r\nLLLDLUDUULLRDDULLRRUDRDLULRLRLLRRUUDRRLRUDLRRLUDRDLLUUDUULRURLDLULUUULDDUURLRUDURRL\r\n', 'output': ['Yes']}, {'input': '-1000000000 -1000000000\r\nDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDL\r\n', 'output': ['Yes']}, {'input': '-100 -100\r\nRU\r\n', 'output': ['No']}]
[{'input': '4 7\r\nUURRDL\r\n', 'output': ['No']}, {'input': '999999999 -999999999\r\nRRRRRRRRRRRRRRRRRRRRRRRRRDDDDDDDDDDDDDDDDDDDDDDDDDLLLLLLLLLLLLLLLLLLLLLLLUUUUUUUUUUUUUUUUUUUUUUU\r\n', 'output': ['Yes']}, {'input': '4 4\r\nUURRDL\r\n', 'output': ['Yes']}, {'input': '1 1\r\nURDLDL\r\n', 'output': ['Yes']}, {'input': '1000000000 1000000000\r\nRURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURURU\r\n', 'output': ['Yes']}]
[{'input': '0 1\r\nUDLR\r\n', 'output': ['Yes']}, {'input': '-261597957 418556728\r\nLLLDLUDUULLRDDULLRRUDRDLULRLRLLRRUUDRRLRUDLRRLUDRDLLUUDUULRURLDLULUUULDDUURLRUDURRL\r\n', 'output': ['Yes']}, {'input': '-2 -2\r\nUURR\r\n', 'output': ['No']}, {'input': '987654321 987654321\r\nUURRDL\r\n', 'output': ['Yes']}, {'input': '1 2\r\nRU\r\n', 'output': ['No']}]
[{'input': '-843450986 632588242\r\nLURLULULRUDUDULRDDLUL\r\n', 'output': ['Yes']}, {'input': '-100 -100\r\nRU\r\n', 'output': ['No']}, {'input': '4 6\r\nUURRDL\r\n', 'output': ['Yes']}, {'input': '3 3\r\nUURR\r\n', 'output': ['No']}, {'input': '-2 -2\r\nUURR\r\n', 'output': ['No']}]
[{'input': '999999999 0\r\nRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\r\n', 'output': ['Yes']}, {'input': '-1 0\r\nR\r\n', 'output': ['No']}, {'input': '100 100\r\nRUL\r\n', 'output': ['No']}, {'input': '-1 1000000000\r\nLRRLU\r\n', 'output': ['Yes']}, {'input': '999999999 -999999999\r\nRRRRRRRRRRRRRRRRRRRRRRRRRDDDDDDDDDDDDDDDDDDDDDDDDDLLLLLLLLLLLLLLLLLLLLLLLUUUUUUUUUUUUUUUUUUUUUUU\r\n', 'output': ['Yes']}]
100
100
100
100
100
100
100
100
100
100
59.09
62.12
71.21
57.58
80.3
9
100
100
66.06
["5 3\n0 4 5 6 7", "1 0\n0", "5 0\n1 2 3 4 5"]
The first line contains two integers n and x (1 ≀ n ≀ 100, 0 ≀ x ≀ 100)Β β€” the size of the set Dr. Evil owns, and the desired MEX. The second line contains n distinct non-negative integers not exceeding 100 that represent the set.
21f579ba807face432a7664091581cd8
#include <stdio.h> int main(){ int n,x,i,t; scanf("%d %d", &n,&x); int ans = x; for(i = 0; i < n; i++){ scanf("%d", &t); if(t < x) ans--; else if(t==x)ans++; } printf("%d\n", ans); return 0; }
["2", "1", "0"]
C
NoteFor the first test case Dr. Evil should add 1 and 2 to the set performing 2 operations.For the second test case Dr. Evil should erase 0 from the set. After that, the set becomes empty, so the MEX of it is 0.In the third test case the set is already evil.
The only line should contain one integerΒ β€” the minimal number of operations Dr. Evil should perform.
Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go.Dr. Evil is interested in sets, He has a set of n integers. Dr. Evil calls a set of integers evil if the MEX of it is exactly x. the MEX of a set of integers is the minimum non-negative integer that doesn't exist in it. For example, the MEX of the set {0, 2, 4} is 1 and the MEX of the set {1, 2, 3} is 0 .Dr. Evil is going to make his set evil. To do this he can perform some operations. During each operation he can add some non-negative integer to his set or erase some element from it. What is the minimal number of operations Dr. Evil has to perform to make his set evil?
[{"input": "5 3\r\n0 4 5 6 7\r\n", "output": ["2"]}, {"input": "1 0\r\n0\r\n", "output": ["1"]}, {"input": "5 0\r\n1 2 3 4 5\r\n", "output": ["0"]}, {"input": "10 5\r\n57 1 47 9 93 37 76 70 78 15\r\n", "output": ["4"]}, {"input": "10 5\r\n99 98 93 97 95 100 92 94 91 96\r\n", "output": ["5"]}, {"input": "10 5\r\n1 2 3 4 59 45 0 58 51 91\r\n", "output": ["0"]}, {"input": "100 100\r\n79 13 21 11 3 87 28 40 29 4 96 34 8 78 61 46 33 45 99 30 92 67 22 97 39 86 73 31 74 44 62 55 57 2 54 63 80 69 25 48 77 98 17 93 15 16 89 12 43 23 37 95 14 38 83 90 49 56 72 10 20 0 50 71 70 88 19 1 76 81 52 41 82 68 85 47 6 7 35 60 18 64 75 84 27 9 65 91 94 42 53 24 66 26 59 36 51 32 5 58\r\n", "output": ["0"]}, {"input": "100 50\r\n95 78 46 92 80 18 79 58 30 72 19 89 39 29 44 65 15 100 59 8 96 9 62 67 41 42 82 14 57 32 71 77 40 5 7 51 28 53 85 23 16 35 3 91 6 11 75 61 17 66 13 47 36 56 10 22 83 60 48 24 26 97 4 33 76 86 70 0 34 64 52 43 21 49 55 74 1 73 81 25 54 63 94 84 20 68 87 12 31 88 38 93 37 90 98 69 99 45 27 2\r\n", "output": ["0"]}, {"input": "100 33\r\n28 11 79 92 88 62 77 72 7 41 96 97 67 84 44 8 81 35 38 1 64 68 46 17 98 83 31 12 74 21 2 22 47 6 36 75 65 61 37 26 25 45 59 48 100 51 93 76 78 49 3 57 16 4 87 29 55 82 70 39 53 0 60 15 24 71 58 20 66 89 95 42 13 43 63 90 85 52 50 30 54 40 56 23 27 34 32 18 10 19 69 9 99 73 91 14 5 80 94 86\r\n", "output": ["0"]}, {"input": "99 33\r\n25 76 41 95 55 20 47 59 58 84 87 92 16 27 35 65 72 63 93 54 36 96 15 86 5 69 24 46 67 73 48 60 40 6 61 74 97 10 100 8 52 26 77 18 7 62 37 2 14 66 11 56 68 91 0 64 75 99 30 21 53 1 89 81 3 98 12 88 39 38 29 83 22 90 9 28 45 43 78 44 32 57 4 50 70 17 13 51 80 85 71 94 82 19 34 42 23 79 49\r\n", "output": ["1"]}, {"input": "100 100\r\n65 56 84 46 44 33 99 74 62 72 93 67 43 92 75 88 38 34 66 12 55 76 58 90 78 8 14 45 97 59 48 32 64 18 39 89 31 51 54 81 29 36 70 77 40 22 49 27 3 1 73 13 98 42 87 37 2 57 4 6 50 25 23 79 28 86 68 61 80 17 19 10 15 63 52 11 35 60 21 16 24 85 30 91 7 5 69 20 71 82 53 94 41 95 96 9 26 83 0 47\r\n", "output": ["0"]}, {"input": "100 100\r\n58 88 12 71 22 1 40 19 73 20 67 48 57 17 69 36 100 35 33 37 72 55 52 8 89 85 47 42 78 70 81 86 11 9 68 99 6 16 21 61 53 98 23 62 32 59 51 0 87 24 50 30 65 10 80 95 7 92 25 74 60 79 91 5 13 31 75 38 90 94 46 66 93 34 14 41 28 2 76 84 43 96 3 56 49 82 27 77 64 63 4 45 18 29 54 39 15 26 83 44\r\n", "output": ["2"]}, {"input": "89 100\r\n58 96 17 41 86 34 28 84 18 40 8 77 87 89 68 79 33 35 53 49 0 6 22 12 72 90 48 55 21 50 56 62 75 2 37 95 69 74 14 20 44 46 27 32 31 59 63 60 10 85 71 70 38 52 94 30 61 51 80 26 36 23 39 47 76 45 100 57 15 78 97 66 54 13 99 16 93 73 24 4 83 5 98 81 92 25 29 88 65\r\n", "output": ["13"]}, {"input": "100 50\r\n7 95 24 76 81 78 60 69 83 84 100 1 65 31 48 92 73 39 18 89 38 97 10 42 8 55 98 51 21 90 62 77 16 91 0 94 4 37 19 17 67 35 45 41 56 20 15 85 75 28 59 27 12 54 61 68 36 5 79 93 66 11 70 49 50 34 30 25 96 46 64 14 32 22 47 40 58 23 43 9 87 82 26 53 80 52 3 86 13 99 33 71 6 88 57 74 2 44 72 63\r\n", "output": ["2"]}, {"input": "77 0\r\n27 8 20 92 21 41 53 98 17 65 67 35 81 11 55 49 61 44 2 66 51 89 40 28 52 62 86 91 64 24 18 5 94 82 96 99 71 6 39 83 26 29 16 30 45 97 80 90 69 12 13 33 76 73 46 19 78 56 88 38 42 34 57 77 47 4 59 58 7 100 95 72 9 74 15 43 54\r\n", "output": ["0"]}, {"input": "100 50\r\n55 36 0 32 81 6 17 43 24 13 30 19 8 59 71 45 15 74 3 41 99 42 86 47 2 94 35 1 66 95 38 49 4 27 96 89 34 44 92 25 51 39 54 28 80 77 20 14 48 40 68 56 31 63 33 78 69 37 18 26 83 70 23 82 91 65 67 52 61 53 7 22 60 21 12 73 72 87 75 100 90 29 64 79 98 85 5 62 93 84 50 46 97 58 57 16 9 10 76 11\r\n", "output": ["1"]}, {"input": "77 0\r\n12 8 19 87 9 54 55 86 97 7 27 85 25 48 94 73 26 1 13 57 72 69 76 39 38 91 75 40 42 28 93 21 70 84 65 11 60 90 20 95 66 89 59 47 34 99 6 61 52 100 50 3 77 81 82 53 15 24 0 45 44 14 68 96 58 5 18 35 10 98 29 74 92 49 83 71 17\r\n", "output": ["1"]}, {"input": "100 70\r\n25 94 66 65 10 99 89 6 70 31 7 40 20 92 64 27 21 72 77 98 17 43 47 44 48 81 38 56 100 39 90 22 88 76 3 83 86 29 33 55 82 79 49 11 2 16 12 78 85 69 32 97 26 15 53 24 23 91 51 67 34 35 52 5 62 50 95 18 71 13 75 8 30 42 93 36 45 60 63 46 57 41 87 0 84 54 74 37 4 58 28 19 96 61 80 9 1 14 73 68\r\n", "output": ["2"]}, {"input": "89 19\r\n14 77 85 81 79 38 91 45 55 51 50 11 62 67 73 76 2 27 16 23 3 29 65 98 78 17 4 58 22 20 34 66 64 31 72 5 32 44 12 75 80 47 18 25 99 0 61 56 71 84 48 88 10 7 86 8 49 24 43 21 37 28 33 54 46 57 40 89 36 97 6 96 39 95 26 74 1 69 9 100 52 30 83 87 68 60 92 90 35\r\n", "output": ["2"]}, {"input": "89 100\r\n69 61 56 45 11 41 42 32 28 29 0 76 7 65 13 35 36 82 10 39 26 34 38 40 92 12 17 54 24 46 88 70 66 27 100 52 85 62 22 48 86 68 21 49 53 94 67 20 1 90 77 84 31 87 58 47 95 33 4 72 93 83 8 51 91 80 99 43 71 19 44 59 98 97 64 9 81 16 79 63 25 37 3 75 2 55 50 6 18\r\n", "output": ["13"]}, {"input": "77 0\r\n38 76 24 74 42 88 29 75 96 46 90 32 59 97 98 60 41 57 80 37 100 49 25 63 95 31 61 68 53 78 27 66 84 48 94 83 30 26 36 99 71 62 45 47 70 28 35 54 34 85 79 43 91 72 86 33 67 92 77 65 69 52 82 55 87 64 56 40 50 44 51 73 89 81 58 93 39\r\n", "output": ["0"]}, {"input": "89 100\r\n38 90 80 64 35 44 56 11 15 89 23 12 49 70 72 60 63 85 92 10 45 83 8 88 41 33 16 6 61 76 62 71 87 13 25 77 74 0 1 37 96 93 7 94 21 82 34 78 4 73 65 20 81 95 50 32 48 17 69 55 68 5 51 27 53 43 91 67 59 46 86 84 99 24 22 3 97 98 40 36 26 58 57 9 42 30 52 2 47\r\n", "output": ["11"]}, {"input": "77 0\r\n55 71 78 86 68 35 53 10 59 32 81 19 74 97 62 61 93 87 96 44 25 18 43 82 84 16 34 48 92 39 64 36 49 91 45 76 95 31 57 29 75 79 13 2 14 24 52 23 33 20 47 99 63 15 5 80 58 67 12 3 85 6 1 27 73 90 4 42 37 70 8 11 89 77 9 22 94\r\n", "output": ["0"]}, {"input": "77 0\r\n12 75 31 71 44 8 3 82 21 77 50 29 57 74 40 10 15 42 84 2 100 9 28 72 92 0 49 11 90 55 17 36 19 54 68 52 4 69 97 91 5 39 59 45 89 62 53 83 16 94 76 60 95 47 30 51 7 48 20 70 67 32 58 78 63 34 56 93 99 88 24 1 66 22 25 14 13\r\n", "output": ["1"]}, {"input": "100 70\r\n91 82 8 85 26 25 95 97 40 87 81 93 7 73 38 94 64 96 74 18 90 19 65 68 72 61 23 43 36 41 60 88 30 33 71 24 52 39 15 3 16 89 86 79 55 4 9 58 67 44 46 29 6 48 84 69 27 21 78 54 51 57 80 53 76 50 47 77 45 12 34 10 100 0 17 31 56 99 98 11 92 5 2 42 32 59 66 62 37 63 28 75 35 1 22 13 83 49 20 14\r\n", "output": ["0"]}, {"input": "77 0\r\n51 5 81 62 30 22 11 0 83 16 79 85 52 70 69 10 8 47 58 3 24 34 44 14 82 66 99 17 28 31 64 67 23 49 94 45 4 12 27 15 21 6 43 72 87 2 63 92 35 39 59 9 90 78 93 20 65 36 60 89 50 41 61 84 77 86 76 100 38 68 53 97 96 95 7 19 88\r\n", "output": ["1"]}, {"input": "1 100\r\n0\r\n", "output": ["99"]}, {"input": "1 0\r\n100\r\n", "output": ["0"]}, {"input": "1 100\r\n100\r\n", "output": ["101"]}, {"input": "2 100\r\n0 100\r\n", "output": ["100"]}, {"input": "5 5\r\n1 2 3 4 5\r\n", "output": ["2"]}, {"input": "5 3\r\n0 3 4 5 6\r\n", "output": ["3"]}, {"input": "7 10\r\n0 1 2 3 4 5 10\r\n", "output": ["5"]}, {"input": "2 2\r\n0 2\r\n", "output": ["2"]}, {"input": "2 1\r\n1 2\r\n", "output": ["2"]}, {"input": "5 1\r\n1 2 3 4 5\r\n", "output": ["2"]}, {"input": "5 2\r\n1 2 3 4 5\r\n", "output": ["2"]}, {"input": "5 6\r\n0 1 2 3 4\r\n", "output": ["1"]}, {"input": "3 2\r\n3 4 5\r\n", "output": ["2"]}]
100
100
100
[{'input': '5 5\r\n1 2 3 4 5\r\n', 'output': ['2']}, {'input': '77 0\r\n38 76 24 74 42 88 29 75 96 46 90 32 59 97 98 60 41 57 80 37 100 49 25 63 95 31 61 68 53 78 27 66 84 48 94 83 30 26 36 99 71 62 45 47 70 28 35 54 34 85 79 43 91 72 86 33 67 92 77 65 69 52 82 55 87 64 56 40 50 44 51 73 89 81 58 93 39\r\n', 'output': ['0']}, {'input': '5 2\r\n1 2 3 4 5\r\n', 'output': ['2']}, {'input': '5 3\r\n0 4 5 6 7\r\n', 'output': ['2']}, {'input': '100 70\r\n25 94 66 65 10 99 89 6 70 31 7 40 20 92 64 27 21 72 77 98 17 43 47 44 48 81 38 56 100 39 90 22 88 76 3 83 86 29 33 55 82 79 49 11 2 16 12 78 85 69 32 97 26 15 53 24 23 91 51 67 34 35 52 5 62 50 95 18 71 13 75 8 30 42 93 36 45 60 63 46 57 41 87 0 84 54 74 37 4 58 28 19 96 61 80 9 1 14 73 68\r\n', 'output': ['2']}]
[{'input': '100 100\r\n79 13 21 11 3 87 28 40 29 4 96 34 8 78 61 46 33 45 99 30 92 67 22 97 39 86 73 31 74 44 62 55 57 2 54 63 80 69 25 48 77 98 17 93 15 16 89 12 43 23 37 95 14 38 83 90 49 56 72 10 20 0 50 71 70 88 19 1 76 81 52 41 82 68 85 47 6 7 35 60 18 64 75 84 27 9 65 91 94 42 53 24 66 26 59 36 51 32 5 58\r\n', 'output': ['0']}, {'input': '2 2\r\n0 2\r\n', 'output': ['2']}, {'input': '100 33\r\n28 11 79 92 88 62 77 72 7 41 96 97 67 84 44 8 81 35 38 1 64 68 46 17 98 83 31 12 74 21 2 22 47 6 36 75 65 61 37 26 25 45 59 48 100 51 93 76 78 49 3 57 16 4 87 29 55 82 70 39 53 0 60 15 24 71 58 20 66 89 95 42 13 43 63 90 85 52 50 30 54 40 56 23 27 34 32 18 10 19 69 9 99 73 91 14 5 80 94 86\r\n', 'output': ['0']}, {'input': '100 100\r\n58 88 12 71 22 1 40 19 73 20 67 48 57 17 69 36 100 35 33 37 72 55 52 8 89 85 47 42 78 70 81 86 11 9 68 99 6 16 21 61 53 98 23 62 32 59 51 0 87 24 50 30 65 10 80 95 7 92 25 74 60 79 91 5 13 31 75 38 90 94 46 66 93 34 14 41 28 2 76 84 43 96 3 56 49 82 27 77 64 63 4 45 18 29 54 39 15 26 83 44\r\n', 'output': ['2']}, {'input': '1 100\r\n100\r\n', 'output': ['101']}]
[{'input': '5 2\r\n1 2 3 4 5\r\n', 'output': ['2']}, {'input': '77 0\r\n51 5 81 62 30 22 11 0 83 16 79 85 52 70 69 10 8 47 58 3 24 34 44 14 82 66 99 17 28 31 64 67 23 49 94 45 4 12 27 15 21 6 43 72 87 2 63 92 35 39 59 9 90 78 93 20 65 36 60 89 50 41 61 84 77 86 76 100 38 68 53 97 96 95 7 19 88\r\n', 'output': ['1']}, {'input': '77 0\r\n12 8 19 87 9 54 55 86 97 7 27 85 25 48 94 73 26 1 13 57 72 69 76 39 38 91 75 40 42 28 93 21 70 84 65 11 60 90 20 95 66 89 59 47 34 99 6 61 52 100 50 3 77 81 82 53 15 24 0 45 44 14 68 96 58 5 18 35 10 98 29 74 92 49 83 71 17\r\n', 'output': ['1']}, {'input': '89 100\r\n58 96 17 41 86 34 28 84 18 40 8 77 87 89 68 79 33 35 53 49 0 6 22 12 72 90 48 55 21 50 56 62 75 2 37 95 69 74 14 20 44 46 27 32 31 59 63 60 10 85 71 70 38 52 94 30 61 51 80 26 36 23 39 47 76 45 100 57 15 78 97 66 54 13 99 16 93 73 24 4 83 5 98 81 92 25 29 88 65\r\n', 'output': ['13']}, {'input': '2 100\r\n0 100\r\n', 'output': ['100']}]
[{'input': '100 100\r\n58 88 12 71 22 1 40 19 73 20 67 48 57 17 69 36 100 35 33 37 72 55 52 8 89 85 47 42 78 70 81 86 11 9 68 99 6 16 21 61 53 98 23 62 32 59 51 0 87 24 50 30 65 10 80 95 7 92 25 74 60 79 91 5 13 31 75 38 90 94 46 66 93 34 14 41 28 2 76 84 43 96 3 56 49 82 27 77 64 63 4 45 18 29 54 39 15 26 83 44\r\n', 'output': ['2']}, {'input': '5 5\r\n1 2 3 4 5\r\n', 'output': ['2']}, {'input': '100 70\r\n25 94 66 65 10 99 89 6 70 31 7 40 20 92 64 27 21 72 77 98 17 43 47 44 48 81 38 56 100 39 90 22 88 76 3 83 86 29 33 55 82 79 49 11 2 16 12 78 85 69 32 97 26 15 53 24 23 91 51 67 34 35 52 5 62 50 95 18 71 13 75 8 30 42 93 36 45 60 63 46 57 41 87 0 84 54 74 37 4 58 28 19 96 61 80 9 1 14 73 68\r\n', 'output': ['2']}, {'input': '89 19\r\n14 77 85 81 79 38 91 45 55 51 50 11 62 67 73 76 2 27 16 23 3 29 65 98 78 17 4 58 22 20 34 66 64 31 72 5 32 44 12 75 80 47 18 25 99 0 61 56 71 84 48 88 10 7 86 8 49 24 43 21 37 28 33 54 46 57 40 89 36 97 6 96 39 95 26 74 1 69 9 100 52 30 83 87 68 60 92 90 35\r\n', 'output': ['2']}, {'input': '77 0\r\n12 75 31 71 44 8 3 82 21 77 50 29 57 74 40 10 15 42 84 2 100 9 28 72 92 0 49 11 90 55 17 36 19 54 68 52 4 69 97 91 5 39 59 45 89 62 53 83 16 94 76 60 95 47 30 51 7 48 20 70 67 32 58 78 63 34 56 93 99 88 24 1 66 22 25 14 13\r\n', 'output': ['1']}]
[{'input': '77 0\r\n12 75 31 71 44 8 3 82 21 77 50 29 57 74 40 10 15 42 84 2 100 9 28 72 92 0 49 11 90 55 17 36 19 54 68 52 4 69 97 91 5 39 59 45 89 62 53 83 16 94 76 60 95 47 30 51 7 48 20 70 67 32 58 78 63 34 56 93 99 88 24 1 66 22 25 14 13\r\n', 'output': ['1']}, {'input': '100 70\r\n91 82 8 85 26 25 95 97 40 87 81 93 7 73 38 94 64 96 74 18 90 19 65 68 72 61 23 43 36 41 60 88 30 33 71 24 52 39 15 3 16 89 86 79 55 4 9 58 67 44 46 29 6 48 84 69 27 21 78 54 51 57 80 53 76 50 47 77 45 12 34 10 100 0 17 31 56 99 98 11 92 5 2 42 32 59 66 62 37 63 28 75 35 1 22 13 83 49 20 14\r\n', 'output': ['0']}, {'input': '1 0\r\n100\r\n', 'output': ['0']}, {'input': '77 0\r\n38 76 24 74 42 88 29 75 96 46 90 32 59 97 98 60 41 57 80 37 100 49 25 63 95 31 61 68 53 78 27 66 84 48 94 83 30 26 36 99 71 62 45 47 70 28 35 54 34 85 79 43 91 72 86 33 67 92 77 65 69 52 82 55 87 64 56 40 50 44 51 73 89 81 58 93 39\r\n', 'output': ['0']}, {'input': '5 3\r\n0 4 5 6 7\r\n', 'output': ['2']}]
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
10
100
100
100
["1\n2\n1\n1\n10", "1\n2\n1\n1\n8"]
The input data contains integers vp, vd, t, f and c, one per line (1 ≀ vp, vd ≀ 100, 1 ≀ t, f ≀ 10, 1 ≀ c ≀ 1000).
c9c03666278acec35f0e273691fe0fff
#include<stdio.h> int main(){ float vp,vd,t,f,c; float phm,d=0,time=0; int bijous=0; scanf("%f%f%f%f%f",&vp,&vd,&t,&f,&c); for(phm=t*vp;;){ //printf("%f\n",phm); if(vd<=vp) break; phm+=phm*vp/(vd-vp); if(phm>=c) break; else{ phm+=f*vp+(phm/vd)*vp; bijous++; } } printf("%d",bijous); return 0; }
["2", "1"]
C
NoteIn the first case one hour after the escape the dragon will discover it, and the princess will be 1 mile away from the cave. In two hours the dragon will overtake the princess 2 miles away from the cave, and she will need to drop the first bijou. Return to the cave and fixing the treasury will take the dragon two more hours; meanwhile the princess will be 4 miles away from the cave. Next time the dragon will overtake the princess 8 miles away from the cave, and she will need the second bijou, but after this she will reach the castle without any further trouble.The second case is similar to the first one, but the second time the dragon overtakes the princess when she has reached the castle, and she won't need the second bijou.
Output the minimal number of bijous required for the escape to succeed.
The princess is going to escape the dragon's cave, and she needs to plan it carefully.The princess runs at vp miles per hour, and the dragon flies at vd miles per hour. The dragon will discover the escape after t hours and will chase the princess immediately. Looks like there's no chance to success, but the princess noticed that the dragon is very greedy and not too smart. To delay him, the princess decides to borrow a couple of bijous from his treasury. Once the dragon overtakes the princess, she will drop one bijou to distract him. In this case he will stop, pick up the item, return to the cave and spend f hours to straighten the things out in the treasury. Only after this will he resume the chase again from the very beginning.The princess is going to run on the straight. The distance between the cave and the king's castle she's aiming for is c miles. How many bijous will she need to take from the treasury to be able to reach the castle? If the dragon overtakes the princess at exactly the same moment she has reached the castle, we assume that she reached the castle before the dragon reached her, and doesn't need an extra bijou to hold him off.
[{"input": "1\r\n2\r\n1\r\n1\r\n10\r\n", "output": ["2"]}, {"input": "1\r\n2\r\n1\r\n1\r\n8\r\n", "output": ["1"]}, {"input": "5\r\n8\r\n1\r\n2\r\n100\r\n", "output": ["2"]}, {"input": "2\r\n100\r\n10\r\n10\r\n739\r\n", "output": ["22"]}, {"input": "17\r\n99\r\n2\r\n3\r\n293\r\n", "output": ["3"]}, {"input": "5\r\n5\r\n1\r\n1\r\n1000\r\n", "output": ["0"]}, {"input": "100\r\n99\r\n1\r\n1\r\n1000\r\n", "output": ["0"]}, {"input": "1\r\n100\r\n1\r\n1\r\n1\r\n", "output": ["0"]}, {"input": "1\r\n100\r\n1\r\n1\r\n1000\r\n", "output": ["152"]}, {"input": "10\r\n1\r\n10\r\n1\r\n11\r\n", "output": ["0"]}, {"input": "98\r\n94\r\n4\r\n3\r\n437\r\n", "output": ["0"]}, {"input": "58\r\n4\r\n1\r\n10\r\n392\r\n", "output": ["0"]}, {"input": "74\r\n11\r\n8\r\n7\r\n835\r\n", "output": ["0"]}, {"input": "86\r\n21\r\n7\r\n2\r\n982\r\n", "output": ["0"]}, {"input": "2\r\n27\r\n4\r\n9\r\n937\r\n", "output": ["15"]}, {"input": "62\r\n89\r\n8\r\n1\r\n83\r\n", "output": ["0"]}, {"input": "78\r\n7\r\n7\r\n6\r\n38\r\n", "output": ["0"]}, {"input": "94\r\n14\r\n2\r\n3\r\n481\r\n", "output": ["0"]}, {"input": "6\r\n24\r\n9\r\n8\r\n628\r\n", "output": ["3"]}, {"input": "59\r\n7\r\n8\r\n10\r\n357\r\n", "output": ["0"]}, {"input": "75\r\n26\r\n4\r\n3\r\n504\r\n", "output": ["0"]}, {"input": "87\r\n32\r\n3\r\n8\r\n754\r\n", "output": ["0"]}, {"input": "51\r\n42\r\n10\r\n4\r\n901\r\n", "output": ["0"]}, {"input": "63\r\n4\r\n7\r\n1\r\n48\r\n", "output": ["0"]}, {"input": "79\r\n10\r\n4\r\n6\r\n3\r\n", "output": ["0"]}, {"input": "95\r\n20\r\n9\r\n3\r\n149\r\n", "output": ["0"]}, {"input": "55\r\n35\r\n5\r\n10\r\n592\r\n", "output": ["0"]}, {"input": "71\r\n45\r\n2\r\n6\r\n547\r\n", "output": ["0"]}, {"input": "83\r\n7\r\n7\r\n7\r\n46\r\n", "output": ["0"]}, {"input": "100\r\n32\r\n1\r\n8\r\n537\r\n", "output": ["0"]}, {"input": "17\r\n42\r\n10\r\n5\r\n684\r\n", "output": ["1"]}, {"input": "77\r\n1\r\n6\r\n8\r\n831\r\n", "output": ["0"]}, {"input": "93\r\n19\r\n3\r\n3\r\n82\r\n", "output": ["0"]}, {"input": "5\r\n25\r\n8\r\n9\r\n228\r\n", "output": ["2"]}, {"input": "21\r\n35\r\n5\r\n6\r\n535\r\n", "output": ["1"]}, {"input": "85\r\n45\r\n2\r\n1\r\n682\r\n", "output": ["0"]}, {"input": "97\r\n4\r\n8\r\n8\r\n829\r\n", "output": ["0"]}, {"input": "13\r\n14\r\n3\r\n3\r\n79\r\n", "output": ["0"]}, {"input": "25\r\n28\r\n4\r\n9\r\n226\r\n", "output": ["0"]}, {"input": "34\r\n9\r\n6\r\n6\r\n70\r\n", "output": ["0"]}, {"input": "50\r\n15\r\n1\r\n3\r\n216\r\n", "output": ["0"]}, {"input": "10\r\n25\r\n9\r\n8\r\n363\r\n", "output": ["1"]}, {"input": "26\r\n36\r\n4\r\n7\r\n318\r\n", "output": ["0"]}, {"input": "38\r\n50\r\n1\r\n8\r\n761\r\n", "output": ["1"]}, {"input": "2\r\n12\r\n6\r\n4\r\n907\r\n", "output": ["10"]}, {"input": "14\r\n18\r\n5\r\n9\r\n862\r\n", "output": ["1"]}, {"input": "30\r\n28\r\n4\r\n6\r\n9\r\n", "output": ["0"]}, {"input": "46\r\n39\r\n8\r\n3\r\n964\r\n", "output": ["0"]}, {"input": "6\r\n45\r\n7\r\n8\r\n407\r\n", "output": ["4"]}, {"input": "67\r\n34\r\n7\r\n4\r\n954\r\n", "output": ["0"]}, {"input": "31\r\n40\r\n6\r\n1\r\n397\r\n", "output": ["0"]}, {"input": "43\r\n50\r\n1\r\n8\r\n544\r\n", "output": ["1"]}, {"input": "59\r\n9\r\n7\r\n3\r\n498\r\n", "output": ["0"]}, {"input": "71\r\n19\r\n2\r\n10\r\n645\r\n", "output": ["0"]}, {"input": "35\r\n37\r\n9\r\n5\r\n792\r\n", "output": ["0"]}, {"input": "47\r\n43\r\n10\r\n9\r\n43\r\n", "output": ["0"]}, {"input": "63\r\n53\r\n5\r\n4\r\n189\r\n", "output": ["0"]}, {"input": "79\r\n11\r\n2\r\n1\r\n144\r\n", "output": ["0"]}, {"input": "39\r\n22\r\n8\r\n6\r\n291\r\n", "output": ["0"]}, {"input": "49\r\n7\r\n2\r\n5\r\n326\r\n", "output": ["0"]}, {"input": "2\r\n1\r\n1\r\n1\r\n1000\r\n", "output": ["0"]}, {"input": "100\r\n1\r\n1\r\n1\r\n1000\r\n", "output": ["0"]}, {"input": "2\r\n1\r\n1\r\n1\r\n100\r\n", "output": ["0"]}, {"input": "2\r\n1\r\n1\r\n1\r\n10\r\n", "output": ["0"]}, {"input": "5\r\n3\r\n3\r\n3\r\n999\r\n", "output": ["0"]}]
100
100
100
[{'input': '30\r\n28\r\n4\r\n6\r\n9\r\n', 'output': ['0']}, {'input': '5\r\n8\r\n1\r\n2\r\n100\r\n', 'output': ['2']}, {'input': '49\r\n7\r\n2\r\n5\r\n326\r\n', 'output': ['0']}, {'input': '2\r\n100\r\n10\r\n10\r\n739\r\n', 'output': ['22']}, {'input': '87\r\n32\r\n3\r\n8\r\n754\r\n', 'output': ['0']}]
[{'input': '50\r\n15\r\n1\r\n3\r\n216\r\n', 'output': ['0']}, {'input': '13\r\n14\r\n3\r\n3\r\n79\r\n', 'output': ['0']}, {'input': '85\r\n45\r\n2\r\n1\r\n682\r\n', 'output': ['0']}, {'input': '35\r\n37\r\n9\r\n5\r\n792\r\n', 'output': ['0']}, {'input': '2\r\n1\r\n1\r\n1\r\n1000\r\n', 'output': ['0']}]
[{'input': '2\r\n1\r\n1\r\n1\r\n1000\r\n', 'output': ['0']}, {'input': '2\r\n1\r\n1\r\n1\r\n100\r\n', 'output': ['0']}, {'input': '13\r\n14\r\n3\r\n3\r\n79\r\n', 'output': ['0']}, {'input': '63\r\n4\r\n7\r\n1\r\n48\r\n', 'output': ['0']}, {'input': '2\r\n12\r\n6\r\n4\r\n907\r\n', 'output': ['10']}]
[{'input': '93\r\n19\r\n3\r\n3\r\n82\r\n', 'output': ['0']}, {'input': '1\r\n2\r\n1\r\n1\r\n8\r\n', 'output': ['1']}, {'input': '31\r\n40\r\n6\r\n1\r\n397\r\n', 'output': ['0']}, {'input': '51\r\n42\r\n10\r\n4\r\n901\r\n', 'output': ['0']}, {'input': '50\r\n15\r\n1\r\n3\r\n216\r\n', 'output': ['0']}]
[{'input': '38\r\n50\r\n1\r\n8\r\n761\r\n', 'output': ['1']}, {'input': '67\r\n34\r\n7\r\n4\r\n954\r\n', 'output': ['0']}, {'input': '79\r\n11\r\n2\r\n1\r\n144\r\n', 'output': ['0']}, {'input': '1\r\n100\r\n1\r\n1\r\n1000\r\n', 'output': ['152']}, {'input': '79\r\n10\r\n4\r\n6\r\n3\r\n', 'output': ['0']}]
100
100
100
100
100
100
85.71
100
100
100
100
75
100
100
100
11
100
97.142
95
["3 2 8", "1 2 -18", "2 2 -1"]
The first line contains three space-separated integers: a, b, c (1 ≀ a ≀ 5;Β 1 ≀ b ≀ 10000;  - 10000 ≀ c ≀ 10000).
e477185b94f93006d7ae84c8f0817009
#include <stdio.h> #include <math.h> int chk(long long x) { int ret = 0; while(x) { ret += (x%10); x/=10; } return ret; } long long po(long long int a,long long x) { if(x == 0) return 1; long long temp; temp = po(a,x/2); temp *= temp; if(x%2) temp *= a; return temp; } int main() { long long int a,b,c; scanf("%lld %lld %lld",&a,&b,&c); long long int i; int cnt = 0; long long ans[100]; for(i=1;i<=81;i++) { long long temp = b*(po(i,a)) + c; if(temp <= 1000000000 && temp >=0 && chk(temp) == i) ans[cnt++] = temp; } printf("%d\n",cnt ); for(i=0;i<cnt;i++) printf("%d ",ans[i] ); return 0; }
["3\n10 2008 13726", "0", "4\n1 31 337 967"]
C
null
Print integer n β€” the number of the solutions that you've found. Next print n integers in the increasing order β€” the solutions of the given equation. Print only integer solutions that are larger than zero and strictly less than 109.
Little Dima misbehaved during a math lesson a lot and the nasty teacher Mr. Pickles gave him the following problem as a punishment. Find all integer solutions x (0 &lt; x &lt; 109) of the equation:x = bΒ·s(x)a + c,  where a, b, c are some predetermined constant values and function s(x) determines the sum of all digits in the decimal representation of number x.The teacher gives this problem to Dima for each lesson. He changes only the parameters of the equation: a, b, c. Dima got sick of getting bad marks and he asks you to help him solve this challenging problem.
[{"input": "3 2 8\r\n", "output": ["3\r\n10 2008 13726"]}, {"input": "1 2 -18\r\n", "output": ["0"]}, {"input": "2 2 -1\r\n", "output": ["4\r\n1 31 337 967"]}, {"input": "1 1 0\r\n", "output": ["9\r\n1 2 3 4 5 6 7 8 9"]}, {"input": "1 37 963\r\n", "output": ["16\r\n1000 1111 1222 1333 1370 1407 1444 1481 1518 1555 1592 1629 1666 1777 1888 1999"]}, {"input": "1 298 -1665\r\n", "output": ["17\r\n123 421 1017 1315 1613 1911 2209 2507 2805 4295 4593 4891 5189 5487 5785 6679 6977"]}, {"input": "1 3034 -9234\r\n", "output": ["23\r\n12004 21106 24140 30208 33242 39310 42344 48412 51446 54480 57514 60548 63582 66616 69650 72684 75718 78752 81786 87854 90888 96956 99990"]}, {"input": "5 9998 9998\r\n", "output": ["0"]}, {"input": "5 10000 10000\r\n", "output": ["0"]}, {"input": "5 65 352\r\n", "output": ["1\r\n208000352"]}, {"input": "5 9999 9999\r\n", "output": ["0"]}, {"input": "4 2099 -38\r\n", "output": ["0"]}, {"input": "1 1 -6708\r\n", "output": ["0"]}, {"input": "5 36 -46\r\n", "output": ["0"]}, {"input": "5 8975 -4\r\n", "output": ["0"]}, {"input": "3 2794 -3354\r\n", "output": ["5\r\n165733932 308990694 392855398 415958984 999999980"]}, {"input": "5 1 4473\r\n", "output": ["11\r\n1424330 14353380 17214841 52526348 60470649 69348430 164920697 184532598 205967449 418199966 459169497"]}, {"input": "5 1 -9999\r\n", "output": ["6\r\n90001 2466100 17200369 52511876 60456177 205952977"]}, {"input": "4 4 6\r\n", "output": ["13\r\n10 1030 40006 114250 202506 262150 521290 937030 1562506 2458630 3694090 4743690 7496650"]}, {"input": "5 19 -666\r\n", "output": ["0"]}, {"input": "5 5 -865\r\n", "output": ["0"]}, {"input": "2 8468 -3666\r\n", "output": ["2\r\n7117922 14933886"]}, {"input": "4 9359 -3039\r\n", "output": ["0"]}, {"input": "5 5706 -1856\r\n", "output": ["0"]}, {"input": "2 6828 -39\r\n", "output": ["2\r\n7435653 17759589"]}, {"input": "5 3903 -9847\r\n", "output": ["0"]}, {"input": "3 1727 4771\r\n", "output": ["1\r\n42124574"]}, {"input": "4 1870 9912\r\n", "output": ["0"]}, {"input": "3 6300 7035\r\n", "output": ["1\r\n466761435"]}, {"input": "5 8704 -6190\r\n", "output": ["0"]}, {"input": "2 68 3\r\n", "output": ["1\r\n45971"]}, {"input": "5 6 -95\r\n", "output": ["1\r\n416063647"]}, {"input": "2 28 12\r\n", "output": ["2\r\n4044 7180"]}, {"input": "3 37 -70\r\n", "output": ["0"]}, {"input": "5 3 53\r\n", "output": ["1\r\n100663349"]}, {"input": "3 2570 4109\r\n", "output": ["2\r\n427587859 999777799"]}, {"input": "3 1139 6335\r\n", "output": ["2\r\n12134407 499999999"]}, {"input": "3 2278 -1329\r\n", "output": ["3\r\n61504671 145790671 999985999"]}, {"input": "4 30 719\r\n", "output": ["2\r\n21219149 899597999"]}, {"input": "4 9023 312\r\n", "output": ["0"]}, {"input": "5 10000 9\r\n", "output": ["0"]}, {"input": "5 7698 5337\r\n", "output": ["0"]}, {"input": "5 1 0\r\n", "output": ["5\r\n1 17210368 52521875 60466176 205962976"]}, {"input": "5 12 3\r\n", "output": ["0"]}, {"input": "5 3903 153\r\n", "output": ["0"]}, {"input": "5 10000 0\r\n", "output": ["1\r\n10000"]}, {"input": "3 2570 -6691\r\n", "output": ["1\r\n999766999"]}, {"input": "5 5 13\r\n", "output": ["1\r\n579281018"]}]
100
100
100
[{'input': '1 1 -6708\r\n', 'output': ['0']}, {'input': '5 7698 5337\r\n', 'output': ['0']}, {'input': '2 28 12\r\n', 'output': ['2\r\n4044 7180']}, {'input': '1 1 0\r\n', 'output': ['9\r\n1 2 3 4 5 6 7 8 9']}, {'input': '3 1727 4771\r\n', 'output': ['1\r\n42124574']}]
[{'input': '4 1870 9912\r\n', 'output': ['0']}, {'input': '2 6828 -39\r\n', 'output': ['2\r\n7435653 17759589']}, {'input': '5 65 352\r\n', 'output': ['1\r\n208000352']}, {'input': '2 28 12\r\n', 'output': ['2\r\n4044 7180']}, {'input': '5 7698 5337\r\n', 'output': ['0']}]
[{'input': '3 1727 4771\r\n', 'output': ['1\r\n42124574']}, {'input': '5 3903 -9847\r\n', 'output': ['0']}, {'input': '1 37 963\r\n', 'output': ['16\r\n1000 1111 1222 1333 1370 1407 1444 1481 1518 1555 1592 1629 1666 1777 1888 1999']}, {'input': '5 5 -865\r\n', 'output': ['0']}, {'input': '2 8468 -3666\r\n', 'output': ['2\r\n7117922 14933886']}]
[{'input': '5 36 -46\r\n', 'output': ['0']}, {'input': '4 1870 9912\r\n', 'output': ['0']}, {'input': '5 10000 10000\r\n', 'output': ['0']}, {'input': '4 9359 -3039\r\n', 'output': ['0']}, {'input': '5 5 13\r\n', 'output': ['1\r\n579281018']}]
[{'input': '3 1139 6335\r\n', 'output': ['2\r\n12134407 499999999']}, {'input': '2 6828 -39\r\n', 'output': ['2\r\n7435653 17759589']}, {'input': '5 5 -865\r\n', 'output': ['0']}, {'input': '1 2 -18\r\n', 'output': ['0']}, {'input': '3 1727 4771\r\n', 'output': ['1\r\n42124574']}]
100
100
100
100
100
100
100
100
100
100
100
93.75
100
100
100
12
100
100
98.75
["1 6 1 2 1 6", "6 5 4 3 2 1", "10 10 1 1 10 10"]
The first line contains six integers n, m, x1, y1, x2, y2 β€” the board sizes and the coordinates of the first and second chips, correspondingly (1 ≀ n, m ≀ 100; 2 ≀ n × m; 1 ≀ x1, x2 ≀ n; 1 ≀ y1, y2 ≀ m). The numbers in the line are separated by single spaces. It is guaranteed that the chips are located in different squares.
41f6f90b7307d2383495441114fa8ea2
#include <stdio.h> #include <stdlib.h> int main() { int i, j, n, m, x1, y1, x2, y2; scanf("%d %d %d %d %d %d", &n, &m, &x1, &y1, &x2, &y2); i = abs(x1 - x2); j = abs(y1 - y2); if (i > j) { int aux = i; i = j; j = aux; } if ((i <= 2 && j <= 4) || (i == 3 && j == 3)) { puts("First"); } else { puts("Second"); } return 0; }
["First", "First", "Second"]
C
null
If the first player wins, print "First" without the quotes. Otherwise, print "Second" without the quotes.
Two players play a game. The game is played on a rectangular board with n × m squares. At the beginning of the game two different squares of the board have two chips. The first player's goal is to shift the chips to the same square. The second player aims to stop the first one with a tube of superglue.We'll describe the rules of the game in more detail.The players move in turns. The first player begins.With every move the first player chooses one of his unglued chips, and shifts it one square to the left, to the right, up or down. It is not allowed to move a chip beyond the board edge. At the beginning of a turn some squares of the board may be covered with a glue. The first player can move the chip to such square, in this case the chip gets tightly glued and cannot move any longer.At each move the second player selects one of the free squares (which do not contain a chip or a glue) and covers it with superglue. The glue dries long and squares covered with it remain sticky up to the end of the game.If, after some move of the first player both chips are in the same square, then the first player wins. If the first player cannot make a move (both of his chips are glued), then the second player wins. Note that the situation where the second player cannot make a move is impossible β€” he can always spread the glue on the square from which the first player has just moved the chip.We will further clarify the case where both chips are glued and are in the same square. In this case the first player wins as the game ends as soon as both chips are in the same square, and the condition of the loss (the inability to move) does not arise.You know the board sizes and the positions of the two chips on it. At the beginning of the game all board squares are glue-free. Find out who wins if the players play optimally.
[{"input": "1 6 1 2 1 6\r\n", "output": ["First"]}, {"input": "6 5 4 3 2 1\r\n", "output": ["First"]}, {"input": "10 10 1 1 10 10\r\n", "output": ["Second"]}, {"input": "1 2 1 1 1 2\r\n", "output": ["First"]}, {"input": "4 4 1 4 4 1\r\n", "output": ["First"]}, {"input": "25 32 17 18 20 19\r\n", "output": ["First"]}, {"input": "30 1 10 1 20 1\r\n", "output": ["Second"]}, {"input": "28 17 20 10 27 2\r\n", "output": ["Second"]}, {"input": "5 5 1 1 5 5\r\n", "output": ["Second"]}, {"input": "5 4 1 4 5 1\r\n", "output": ["Second"]}, {"input": "95 28 50 12 50 13\r\n", "output": ["First"]}, {"input": "7 41 3 5 3 6\r\n", "output": ["First"]}, {"input": "45 62 28 48 28 50\r\n", "output": ["First"]}, {"input": "57 17 12 7 12 10\r\n", "output": ["First"]}, {"input": "73 88 30 58 30 62\r\n", "output": ["First"]}, {"input": "33 13 12 1 12 6\r\n", "output": ["Second"]}, {"input": "49 34 38 19 38 25\r\n", "output": ["Second"]}, {"input": "61 39 14 30 14 37\r\n", "output": ["Second"]}, {"input": "100 32 71 12 71 22\r\n", "output": ["Second"]}, {"input": "96 54 9 30 9 47\r\n", "output": ["Second"]}, {"input": "57 85 29 40 29 69\r\n", "output": ["Second"]}, {"input": "64 96 4 2 4 80\r\n", "output": ["Second"]}, {"input": "99 100 24 1 24 100\r\n", "output": ["Second"]}, {"input": "18 72 2 71 3 71\r\n", "output": ["First"]}, {"input": "24 68 19 14 18 15\r\n", "output": ["First"]}, {"input": "24 32 6 2 7 4\r\n", "output": ["First"]}, {"input": "28 14 21 2 20 5\r\n", "output": ["First"]}, {"input": "30 85 9 45 8 49\r\n", "output": ["First"]}, {"input": "34 55 7 25 8 30\r\n", "output": ["Second"]}, {"input": "34 39 18 1 17 7\r\n", "output": ["Second"]}, {"input": "21 18 16 6 15 17\r\n", "output": ["Second"]}, {"input": "37 100 33 13 32 30\r\n", "output": ["Second"]}, {"input": "11 97 2 29 1 76\r\n", "output": ["Second"]}, {"input": "89 100 54 1 55 100\r\n", "output": ["Second"]}, {"input": "80 97 70 13 68 13\r\n", "output": ["First"]}, {"input": "24 97 21 54 19 55\r\n", "output": ["First"]}, {"input": "76 7 24 4 26 6\r\n", "output": ["First"]}, {"input": "20 77 5 49 3 52\r\n", "output": ["First"]}, {"input": "18 18 11 12 13 16\r\n", "output": ["First"]}, {"input": "60 100 28 80 26 85\r\n", "output": ["Second"]}, {"input": "14 96 3 80 1 86\r\n", "output": ["Second"]}, {"input": "40 43 40 9 38 28\r\n", "output": ["Second"]}, {"input": "44 99 10 5 8 92\r\n", "output": ["Second"]}, {"input": "52 70 26 65 23 65\r\n", "output": ["First"]}, {"input": "13 25 4 2 7 3\r\n", "output": ["First"]}, {"input": "36 76 36 49 33 51\r\n", "output": ["First"]}, {"input": "64 91 52 64 49 67\r\n", "output": ["First"]}, {"input": "87 15 56 8 59 12\r\n", "output": ["Second"]}, {"input": "48 53 24 37 21 42\r\n", "output": ["Second"]}, {"input": "71 85 10 14 13 20\r\n", "output": ["Second"]}, {"input": "23 90 6 31 9 88\r\n", "output": ["Second"]}, {"input": "47 95 27 70 23 70\r\n", "output": ["First"]}, {"input": "63 54 19 22 23 23\r\n", "output": ["First"]}, {"input": "47 91 36 61 32 63\r\n", "output": ["First"]}, {"input": "63 22 54 16 58 19\r\n", "output": ["Second"]}, {"input": "15 11 12 5 8 9\r\n", "output": ["Second"]}, {"input": "31 80 28 70 24 75\r\n", "output": ["Second"]}, {"input": "15 48 6 42 10 48\r\n", "output": ["Second"]}, {"input": "21 68 2 13 6 57\r\n", "output": ["Second"]}, {"input": "73 64 63 32 68 32\r\n", "output": ["Second"]}, {"input": "89 81 33 18 28 19\r\n", "output": ["Second"]}, {"input": "13 62 10 13 5 15\r\n", "output": ["Second"]}, {"input": "35 19 4 8 9 11\r\n", "output": ["Second"]}, {"input": "51 8 24 3 19 7\r\n", "output": ["Second"]}, {"input": "73 27 40 8 45 13\r\n", "output": ["Second"]}, {"input": "51 76 50 5 45 76\r\n", "output": ["Second"]}, {"input": "74 88 33 20 39 20\r\n", "output": ["Second"]}, {"input": "28 7 17 5 11 6\r\n", "output": ["Second"]}, {"input": "8 33 2 21 8 23\r\n", "output": ["Second"]}, {"input": "30 47 9 32 3 35\r\n", "output": ["Second"]}, {"input": "10 5 10 1 4 5\r\n", "output": ["Second"]}, {"input": "84 43 71 6 77 26\r\n", "output": ["Second"]}, {"input": "87 13 77 7 70 7\r\n", "output": ["Second"]}, {"input": "41 34 27 7 20 8\r\n", "output": ["Second"]}, {"input": "73 79 17 42 10 67\r\n", "output": ["Second"]}, {"input": "48 86 31 36 23 36\r\n", "output": ["Second"]}, {"input": "16 97 7 4 15 94\r\n", "output": ["Second"]}, {"input": "48 11 33 8 24 8\r\n", "output": ["Second"]}, {"input": "39 46 21 22 30 35\r\n", "output": ["Second"]}, {"input": "96 75 15 10 6 65\r\n", "output": ["Second"]}, {"input": "25 68 3 39 20 41\r\n", "output": ["Second"]}, {"input": "41 64 10 21 29 50\r\n", "output": ["Second"]}, {"input": "24 65 23 18 3 64\r\n", "output": ["Second"]}, {"input": "40 100 4 1 30 100\r\n", "output": ["Second"]}, {"input": "73 95 58 11 11 24\r\n", "output": ["Second"]}, {"input": "89 51 76 1 25 51\r\n", "output": ["Second"]}, {"input": "77 99 56 1 3 99\r\n", "output": ["Second"]}, {"input": "97 94 96 2 7 93\r\n", "output": ["Second"]}, {"input": "100 100 1 1 100 100\r\n", "output": ["Second"]}, {"input": "100 94 1 30 100 30\r\n", "output": ["Second"]}, {"input": "10 10 1 1 4 5\r\n", "output": ["Second"]}, {"input": "5 5 1 1 4 5\r\n", "output": ["Second"]}, {"input": "100 100 1 1 5 4\r\n", "output": ["Second"]}, {"input": "100 100 10 10 13 14\r\n", "output": ["Second"]}, {"input": "10 10 1 1 5 4\r\n", "output": ["Second"]}, {"input": "10 10 1 1 1 6\r\n", "output": ["Second"]}, {"input": "100 100 1 1 4 5\r\n", "output": ["Second"]}, {"input": "100 100 1 1 3 5\r\n", "output": ["First"]}, {"input": "4 5 1 1 4 5\r\n", "output": ["Second"]}, {"input": "5 5 1 1 3 5\r\n", "output": ["First"]}, {"input": "50 50 1 1 5 4\r\n", "output": ["Second"]}, {"input": "5 5 1 5 4 1\r\n", "output": ["Second"]}, {"input": "100 100 1 1 2 6\r\n", "output": ["Second"]}, {"input": "50 50 1 1 4 5\r\n", "output": ["Second"]}, {"input": "5 5 1 1 5 4\r\n", "output": ["Second"]}, {"input": "10 10 1 1 3 5\r\n", "output": ["First"]}, {"input": "6 6 1 1 6 1\r\n", "output": ["Second"]}, {"input": "5 4 1 1 5 4\r\n", "output": ["Second"]}, {"input": "6 2 6 1 1 2\r\n", "output": ["Second"]}, {"input": "10 10 3 4 3 5\r\n", "output": ["First"]}, {"input": "10 10 1 1 5 3\r\n", "output": ["First"]}, {"input": "10 10 6 1 1 1\r\n", "output": ["Second"]}, {"input": "10 10 1 1 6 2\r\n", "output": ["Second"]}, {"input": "50 50 1 1 5 2\r\n", "output": ["First"]}, {"input": "3 5 1 1 3 5\r\n", "output": ["First"]}, {"input": "5 5 1 1 5 3\r\n", "output": ["First"]}, {"input": "10 10 7 7 3 4\r\n", "output": ["Second"]}, {"input": "100 100 1 1 5 1\r\n", "output": ["First"]}, {"input": "6 6 1 1 1 6\r\n", "output": ["Second"]}]
100
100
100
[{'input': '10 10 1 1 10 10\r\n', 'output': ['Second']}, {'input': '13 62 10 13 5 15\r\n', 'output': ['Second']}, {'input': '48 53 24 37 21 42\r\n', 'output': ['Second']}, {'input': '64 91 52 64 49 67\r\n', 'output': ['First']}, {'input': '25 68 3 39 20 41\r\n', 'output': ['Second']}]
[{'input': '1 2 1 1 1 2\r\n', 'output': ['First']}, {'input': '60 100 28 80 26 85\r\n', 'output': ['Second']}, {'input': '89 100 54 1 55 100\r\n', 'output': ['Second']}, {'input': '73 27 40 8 45 13\r\n', 'output': ['Second']}, {'input': '3 5 1 1 3 5\r\n', 'output': ['First']}]
[{'input': '50 50 1 1 5 4\r\n', 'output': ['Second']}, {'input': '16 97 7 4 15 94\r\n', 'output': ['Second']}, {'input': '10 10 1 1 1 6\r\n', 'output': ['Second']}, {'input': '63 22 54 16 58 19\r\n', 'output': ['Second']}, {'input': '48 53 24 37 21 42\r\n', 'output': ['Second']}]
[{'input': '5 5 1 1 4 5\r\n', 'output': ['Second']}, {'input': '47 91 36 61 32 63\r\n', 'output': ['First']}, {'input': '95 28 50 12 50 13\r\n', 'output': ['First']}, {'input': '10 10 1 1 6 2\r\n', 'output': ['Second']}, {'input': '100 100 1 1 3 5\r\n', 'output': ['First']}]
[{'input': '7 41 3 5 3 6\r\n', 'output': ['First']}, {'input': '61 39 14 30 14 37\r\n', 'output': ['Second']}, {'input': '47 95 27 70 23 70\r\n', 'output': ['First']}, {'input': '4 4 1 4 4 1\r\n', 'output': ['First']}, {'input': '100 100 1 1 3 5\r\n', 'output': ['First']}]
100
100
100
100
100
100
75
91.67
100
100
90
60
80
90
90
13
100
93.334
82
["2 3", "8 2"]
The first line of the input contains two integers, given in the decimal notation, n and m (1 ≀ n, m ≀ 109)Β β€” the number of hours in one day and the number of minutes in one hour, respectively.
0930c75f57dd88a858ba7bb0f11f1b1c
#include <stdlib.h> #include <stdio.h> int main() { int n, m, d; scanf("%d%d", &n, &m); int dn = 1, dm = 1; for(int k = 7 ; k < n ; k *= 7) dn++; for(int k = 7 ; k < m ; k *= 7) dm++; d = dn + dm; if(d > 7) { printf("0\n"); return 0; } int r = 0; for(int i=0 ; i<n ; i++) { for(int j=0 ; j<m ; j++) { int u[7] = {0}; int a = i, b = j; for(int k=0 ; k<dn ; k++) { u[a%7]++; a /= 7; } for(int k=0 ; k<dm ; k++) { u[b%7]++; b /= 7; } r++; for(int k=0 ; k<7 ; k++) { if(u[k] > 1) { r--; break; } } } } printf("%d\n", r); return 0; }
["4", "5"]
C
NoteIn the first sample, possible pairs are: (0: 1), (0: 2), (1: 0), (1: 2).In the second sample, possible pairs are: (02: 1), (03: 1), (04: 1), (05: 1), (06: 1).
Print one integer in decimal notationΒ β€” the number of different pairs of hour and minute, such that all digits displayed on the watches are distinct.
Robbers, who attacked the Gerda's cab, are very successful in covering from the kingdom police. To make the goal of catching them even harder, they use their own watches.First, as they know that kingdom police is bad at math, robbers use the positional numeral system with base 7. Second, they divide one day in n hours, and each hour in m minutes. Personal watches of each robber are divided in two parts: first of them has the smallest possible number of places that is necessary to display any integer from 0 to n - 1, while the second has the smallest possible number of places that is necessary to display any integer from 0 to m - 1. Finally, if some value of hours or minutes can be displayed using less number of places in base 7 than this watches have, the required number of zeroes is added at the beginning of notation.Note that to display number 0 section of the watches is required to have at least one place.Little robber wants to know the number of moments of time (particular values of hours and minutes), such that all digits displayed on the watches are distinct. Help her calculate this number.
[{"input": "2 3\r\n", "output": ["4"]}, {"input": "8 2\r\n", "output": ["5"]}, {"input": "1 1\r\n", "output": ["0"]}, {"input": "1 2\r\n", "output": ["1"]}, {"input": "8 8\r\n", "output": ["0"]}, {"input": "50 50\r\n", "output": ["0"]}, {"input": "344 344\r\n", "output": ["0"]}, {"input": "282475250 282475250\r\n", "output": ["0"]}, {"input": "8 282475250\r\n", "output": ["0"]}, {"input": "1000000000 1000000000\r\n", "output": ["0"]}, {"input": "16808 7\r\n", "output": ["720"]}, {"input": "2402 50\r\n", "output": ["0"]}, {"input": "343 2401\r\n", "output": ["5040"]}, {"input": "1582 301\r\n", "output": ["2874"]}, {"input": "421414245 4768815\r\n", "output": ["0"]}, {"input": "2401 343\r\n", "output": ["5040"]}, {"input": "2 1\r\n", "output": ["1"]}, {"input": "282475250 8\r\n", "output": ["0"]}, {"input": "8 7\r\n", "output": ["35"]}, {"input": "50 7\r\n", "output": ["120"]}, {"input": "16808 8\r\n", "output": ["0"]}, {"input": "2402 49\r\n", "output": ["720"]}, {"input": "123 123\r\n", "output": ["360"]}, {"input": "123 456\r\n", "output": ["150"]}, {"input": "1 9\r\n", "output": ["0"]}, {"input": "1 10\r\n", "output": ["1"]}, {"input": "50 67\r\n", "output": ["6"]}, {"input": "7 117649\r\n", "output": ["5040"]}, {"input": "2400 342\r\n", "output": ["5040"]}, {"input": "2400 227\r\n", "output": ["3360"]}, {"input": "117648 5\r\n", "output": ["3600"]}, {"input": "16808 41\r\n", "output": ["0"]}, {"input": "3 16808\r\n", "output": ["240"]}, {"input": "823542 3\r\n", "output": ["0"]}, {"input": "3 823544\r\n", "output": ["0"]}, {"input": "117650 5\r\n", "output": ["0"]}, {"input": "50 50\r\n", "output": ["0"]}, {"input": "50 3\r\n", "output": ["40"]}, {"input": "2402 343\r\n", "output": ["0"]}]
100
100
100
[{'input': '2402 50\r\n', 'output': ['0']}, {'input': '3 16808\r\n', 'output': ['240']}, {'input': '50 7\r\n', 'output': ['120']}, {'input': '16808 41\r\n', 'output': ['0']}, {'input': '8 282475250\r\n', 'output': ['0']}]
[{'input': '8 8\r\n', 'output': ['0']}, {'input': '50 7\r\n', 'output': ['120']}, {'input': '2402 49\r\n', 'output': ['720']}, {'input': '1 1\r\n', 'output': ['0']}, {'input': '2 3\r\n', 'output': ['4']}]
[{'input': '3 823544\r\n', 'output': ['0']}, {'input': '282475250 282475250\r\n', 'output': ['0']}, {'input': '8 8\r\n', 'output': ['0']}, {'input': '2402 343\r\n', 'output': ['0']}, {'input': '1 2\r\n', 'output': ['1']}]
[{'input': '8 2\r\n', 'output': ['5']}, {'input': '8 8\r\n', 'output': ['0']}, {'input': '2402 49\r\n', 'output': ['720']}, {'input': '117650 5\r\n', 'output': ['0']}, {'input': '343 2401\r\n', 'output': ['5040']}]
[{'input': '7 117649\r\n', 'output': ['5040']}, {'input': '282475250 8\r\n', 'output': ['0']}, {'input': '343 2401\r\n', 'output': ['5040']}, {'input': '50 7\r\n', 'output': ['120']}, {'input': '344 344\r\n', 'output': ['0']}]
100
100
100
100
100
100
92.59
100
100
100
100
94.44
100
100
100
14
100
98.518
98.888
["500 1000 20 30", "1000 1000 1 1", "1500 1000 176 177"]
The first line contains four integers a, b, c, d (250 ≀ a, b ≀ 3500, 0 ≀ c, d ≀ 180). It is guaranteed that numbers a and b are divisible by 250 (just like on any real Codeforces round).
95b19d7569d6b70bd97d46a8541060d0
#include <stdio.h> int max(int a, int b){ int maxim; return maxim=(a>=b)?a:b; } int main(void) { int a,b,c,d, misha, vasya; scanf("%d %d %d %d", &a,&b,&c,&d); misha = max((3*a)/10 ,a- ((a*c)/250)); vasya = max((3*b)/10 ,b-((b*d)/250)); if(misha>vasya) printf("Misha"); else if(misha<vasya) printf("Vasya"); else printf("Tie"); return 0; }
["Vasya", "Tie", "Misha"]
C
null
Output on a single line: "Misha" (without the quotes), if Misha got more points than Vasya. "Vasya" (without the quotes), if Vasya got more points than Misha. "Tie" (without the quotes), if both of them got the same number of points.
Misha and Vasya participated in a Codeforces contest. Unfortunately, each of them solved only one problem, though successfully submitted it at the first attempt. Misha solved the problem that costs a points and Vasya solved the problem that costs b points. Besides, Misha submitted the problem c minutes after the contest started and Vasya submitted the problem d minutes after the contest started. As you know, on Codeforces the cost of a problem reduces as a round continues. That is, if you submit a problem that costs p points t minutes after the contest started, you get points. Misha and Vasya are having an argument trying to find out who got more points. Help them to find out the truth.
[{"input": "500 1000 20 30\r\n", "output": ["Vasya"]}, {"input": "1000 1000 1 1\r\n", "output": ["Tie"]}, {"input": "1500 1000 176 177\r\n", "output": ["Misha"]}, {"input": "1500 1000 74 177\r\n", "output": ["Misha"]}, {"input": "750 2500 175 178\r\n", "output": ["Vasya"]}, {"input": "750 1000 54 103\r\n", "output": ["Tie"]}, {"input": "2000 1250 176 130\r\n", "output": ["Tie"]}, {"input": "1250 1750 145 179\r\n", "output": ["Tie"]}, {"input": "2000 2000 176 179\r\n", "output": ["Tie"]}, {"input": "1500 1500 148 148\r\n", "output": ["Tie"]}, {"input": "2750 1750 134 147\r\n", "output": ["Misha"]}, {"input": "3250 250 175 173\r\n", "output": ["Misha"]}, {"input": "500 500 170 176\r\n", "output": ["Misha"]}, {"input": "250 1000 179 178\r\n", "output": ["Vasya"]}, {"input": "3250 1000 160 138\r\n", "output": ["Misha"]}, {"input": "3000 2000 162 118\r\n", "output": ["Tie"]}, {"input": "1500 1250 180 160\r\n", "output": ["Tie"]}, {"input": "1250 2500 100 176\r\n", "output": ["Tie"]}, {"input": "3500 3500 177 178\r\n", "output": ["Tie"]}, {"input": "3000 3250 16 34\r\n", "output": ["Tie"]}, {"input": "1750 3000 137 49\r\n", "output": ["Vasya"]}, {"input": "500 1500 179 71\r\n", "output": ["Vasya"]}, {"input": "1250 2000 101 180\r\n", "output": ["Misha"]}, {"input": "250 750 180 176\r\n", "output": ["Vasya"]}, {"input": "2250 2250 163 145\r\n", "output": ["Vasya"]}, {"input": "3000 3000 176 78\r\n", "output": ["Vasya"]}, {"input": "250 3500 8 178\r\n", "output": ["Vasya"]}, {"input": "1750 1250 179 180\r\n", "output": ["Misha"]}, {"input": "2750 1750 13 164\r\n", "output": ["Misha"]}, {"input": "1750 2250 178 53\r\n", "output": ["Vasya"]}, {"input": "2500 2750 73 179\r\n", "output": ["Misha"]}, {"input": "1000 3500 178 175\r\n", "output": ["Vasya"]}, {"input": "1000 500 7 162\r\n", "output": ["Misha"]}, {"input": "1000 250 175 48\r\n", "output": ["Misha"]}, {"input": "1750 500 166 177\r\n", "output": ["Misha"]}, {"input": "250 250 0 0\r\n", "output": ["Tie"]}, {"input": "250 3500 0 0\r\n", "output": ["Vasya"]}, {"input": "250 3500 0 180\r\n", "output": ["Vasya"]}, {"input": "3500 3500 180 180\r\n", "output": ["Tie"]}, {"input": "3500 250 0 180\r\n", "output": ["Misha"]}]
100
100
100
[{'input': '500 500 170 176\r\n', 'output': ['Misha']}, {'input': '1250 2000 101 180\r\n', 'output': ['Misha']}, {'input': '750 2500 175 178\r\n', 'output': ['Vasya']}, {'input': '1000 1000 1 1\r\n', 'output': ['Tie']}, {'input': '750 1000 54 103\r\n', 'output': ['Tie']}]
[{'input': '1750 500 166 177\r\n', 'output': ['Misha']}, {'input': '1000 500 7 162\r\n', 'output': ['Misha']}, {'input': '2750 1750 134 147\r\n', 'output': ['Misha']}, {'input': '1500 1250 180 160\r\n', 'output': ['Tie']}, {'input': '2000 1250 176 130\r\n', 'output': ['Tie']}]
[{'input': '250 3500 0 0\r\n', 'output': ['Vasya']}, {'input': '2750 1750 134 147\r\n', 'output': ['Misha']}, {'input': '500 1500 179 71\r\n', 'output': ['Vasya']}, {'input': '1250 2000 101 180\r\n', 'output': ['Misha']}, {'input': '1750 1250 179 180\r\n', 'output': ['Misha']}]
[{'input': '1000 1000 1 1\r\n', 'output': ['Tie']}, {'input': '750 1000 54 103\r\n', 'output': ['Tie']}, {'input': '3000 3000 176 78\r\n', 'output': ['Vasya']}, {'input': '500 1500 179 71\r\n', 'output': ['Vasya']}, {'input': '2000 2000 176 179\r\n', 'output': ['Tie']}]
[{'input': '500 1000 20 30\r\n', 'output': ['Vasya']}, {'input': '250 3500 0 180\r\n', 'output': ['Vasya']}, {'input': '250 250 0 0\r\n', 'output': ['Tie']}, {'input': '1000 3500 178 175\r\n', 'output': ['Vasya']}, {'input': '2750 1750 134 147\r\n', 'output': ['Misha']}]
100
100
100
100
100
100
100
90
100
100
100
75
75
75
100
15
100
98
85
["4 2 4\n3 4\n1 1", "5 4 0\n1 2\n3 1"]
The first line contains three integers s, x1 and x2 (2 ≀ s ≀ 1000, 0 ≀ x1, x2 ≀ s, x1 ≠ x2)Β β€” the maximum coordinate of the point to which the tram goes, the point Igor is at, and the point he should come to. The second line contains two integers t1 and t2 (1 ≀ t1, t2 ≀ 1000)Β β€” the time in seconds in which the tram passes 1 meter and the time in seconds in which Igor passes 1 meter. The third line contains two integers p and d (1 ≀ p ≀ s - 1, d is either 1 or )Β β€” the position of the tram in the moment Igor came to the point x1 and the direction of the tram at this moment. If , the tram goes in the direction from the point s to the point 0. If d = 1, the tram goes in the direction from the point 0 to the point s.
fb3aca6eba3a952e9d5736c5d8566821
#include<stdio.h> int t,T1,T2,s,f,x1,x2,p,d,t1,t2,i;///T2 οΏ½οΏ½ T1 οΏ½οΏ½ int main() { scanf("%d %d %d %d %d %d %d",&s,&x1,&x2,&t1,&t2,&p,&d); if(x2-x1>0) f=1; else f=-1; T2=(x2-x1)*t2*f; if(t1<t2){ if((x1<x2&&x2<=p&&d<0)||(x1<=p&&p<=x2&&d<0)||(p<=x1&&x1<x2)||(x1<=p&&x1>x2&&d<0)){ t=(f*x1-d*p)*t1*t2/(t2-t1); } else t=(2*s+x1*f-d*p)*t1*t2/(t2-t1); } else { printf("%d",T2); return 0; } if(t<T2){ if((x1<x2&&x2<=p&&d<0)||(x1<=p&&p<=x2&&d<0)||(p<=x1&&x1<x2)||(x1<=p&&x1>x2&&d<0)){ t=(f*x2-d*p)*t1; } else t=(2*s+x2*f-d*p)*t1; printf("%d",t); } else printf("%d",T2); return 0; }
["8", "7"]
C
NoteIn the first example it is profitable for Igor to go by foot and not to wait the tram. Thus, he has to pass 2 meters and it takes 8 seconds in total, because he passes 1 meter per 4 seconds. In the second example Igor can, for example, go towards the point x2 and get to the point 1 in 6 seconds (because he has to pass 3 meters, but he passes 1 meters per 2 seconds). At that moment the tram will be at the point 1, so Igor can enter the tram and pass 1 meter in 1 second. Thus, Igor will reach the point x2 in 7 seconds in total.
Print the minimum time in seconds which Igor needs to get from the point x1 to the point x2.
The tram in Berland goes along a straight line from the point 0 to the point s and back, passing 1 meter per t1 seconds in both directions. It means that the tram is always in the state of uniform rectilinear motion, instantly turning around at points x = 0 and x = s.Igor is at the point x1. He should reach the point x2. Igor passes 1 meter per t2 seconds. Your task is to determine the minimum time Igor needs to get from the point x1 to the point x2, if it is known where the tram is and in what direction it goes at the moment Igor comes to the point x1.Igor can enter the tram unlimited number of times at any moment when his and the tram's positions coincide. It is not obligatory that points in which Igor enter and exit the tram are integers. Assume that any boarding and unboarding happens instantly. Igor can move arbitrary along the line (but not faster than 1 meter per t2 seconds). He can also stand at some point for some time.
[{"input": "4 2 4\r\n3 4\r\n1 1\r\n", "output": ["8"]}, {"input": "5 4 0\r\n1 2\r\n3 1\r\n", "output": ["7"]}, {"input": "5 4 0\r\n5 14\r\n1 -1\r\n", "output": ["55"]}, {"input": "10 7 2\r\n7 9\r\n9 -1\r\n", "output": ["45"]}, {"input": "20 5 19\r\n163 174\r\n4 1\r\n", "output": ["2436"]}, {"input": "1000 610 733\r\n226 690\r\n357 1\r\n", "output": ["84870"]}, {"input": "40 31 14\r\n628 1000\r\n36 1\r\n", "output": ["17000"]}, {"input": "100 20 83\r\n186 434\r\n64 -1\r\n", "output": ["27342"]}, {"input": "200 179 81\r\n126 457\r\n37 -1\r\n", "output": ["44786"]}, {"input": "400 30 81\r\n193 1000\r\n338 1\r\n", "output": ["51000"]}, {"input": "500 397 440\r\n202 1000\r\n75 1\r\n", "output": ["43000"]}, {"input": "600 443 587\r\n260 1000\r\n548 -1\r\n", "output": ["144000"]}, {"input": "799 254 294\r\n539 1000\r\n284 -1\r\n", "output": ["40000"]}, {"input": "801 489 351\r\n86 702\r\n125 1\r\n", "output": ["96836"]}, {"input": "999 951 297\r\n62 106\r\n574 1\r\n", "output": ["69324"]}, {"input": "1000 711 437\r\n42 126\r\n745 1\r\n", "output": ["34356"]}, {"input": "1000 812 761\r\n230 1000\r\n696 -1\r\n", "output": ["51000"]}, {"input": "1000 913 474\r\n34 162\r\n566 -1\r\n", "output": ["71118"]}, {"input": "1000 394 798\r\n155 673\r\n954 -1\r\n", "output": ["271560"]}, {"input": "1000 876 884\r\n299 1000\r\n825 1\r\n", "output": ["8000"]}, {"input": "2 0 2\r\n1 1\r\n1 1\r\n", "output": ["2"]}, {"input": "5 4 2\r\n1 2\r\n3 1\r\n", "output": ["4"]}, {"input": "4 2 4\r\n3 4\r\n2 1\r\n", "output": ["6"]}, {"input": "200 10 100\r\n1 100\r\n20 1\r\n", "output": ["480"]}, {"input": "6 4 2\r\n1 2\r\n3 1\r\n", "output": ["4"]}, {"input": "3 1 3\r\n1 2\r\n1 1\r\n", "output": ["2"]}, {"input": "10 3 6\r\n1 2\r\n3 1\r\n", "output": ["3"]}, {"input": "1000 50 51\r\n1 3\r\n50 1\r\n", "output": ["1"]}, {"input": "100 1 2\r\n1 100\r\n1 1\r\n", "output": ["1"]}, {"input": "5 1 4\r\n1 100\r\n1 1\r\n", "output": ["3"]}, {"input": "10 0 5\r\n1 100\r\n7 1\r\n", "output": ["18"]}, {"input": "5 4 1\r\n1 100\r\n4 -1\r\n", "output": ["3"]}, {"input": "10 6 9\r\n3 100\r\n5 1\r\n", "output": ["12"]}, {"input": "50 10 30\r\n1 50\r\n10 1\r\n", "output": ["20"]}, {"input": "4 1 4\r\n1 100\r\n2 1\r\n", "output": ["10"]}, {"input": "10 5 9\r\n1 10\r\n5 1\r\n", "output": ["4"]}, {"input": "20 15 10\r\n5 2\r\n3 1\r\n", "output": ["10"]}, {"input": "2 2 0\r\n7 3\r\n1 1\r\n", "output": ["6"]}, {"input": "10 1 9\r\n1 10\r\n1 1\r\n", "output": ["8"]}, {"input": "1000 2 902\r\n1 1000\r\n2 1\r\n", "output": ["900"]}, {"input": "100 9 6\r\n3 100\r\n5 1\r\n", "output": ["300"]}, {"input": "10 1 6\r\n1 10\r\n3 -1\r\n", "output": ["9"]}, {"input": "1000 902 2\r\n1 1000\r\n902 -1\r\n", "output": ["900"]}, {"input": "100 50 25\r\n1 1000\r\n10 1\r\n", "output": ["165"]}, {"input": "5 3 0\r\n1 2\r\n4 -1\r\n", "output": ["4"]}, {"input": "4 1 2\r\n1 10\r\n3 1\r\n", "output": ["7"]}, {"input": "10 4 8\r\n1 5\r\n4 -1\r\n", "output": ["12"]}]
100
100
100
[{'input': '10 3 6\r\n1 2\r\n3 1\r\n', 'output': ['3']}, {'input': '100 9 6\r\n3 100\r\n5 1\r\n', 'output': ['300']}, {'input': '1000 876 884\r\n299 1000\r\n825 1\r\n', 'output': ['8000']}, {'input': '10 7 2\r\n7 9\r\n9 -1\r\n', 'output': ['45']}, {'input': '1000 812 761\r\n230 1000\r\n696 -1\r\n', 'output': ['51000']}]
[{'input': '10 0 5\r\n1 100\r\n7 1\r\n', 'output': ['18']}, {'input': '5 3 0\r\n1 2\r\n4 -1\r\n', 'output': ['4']}, {'input': '200 10 100\r\n1 100\r\n20 1\r\n', 'output': ['480']}, {'input': '20 15 10\r\n5 2\r\n3 1\r\n', 'output': ['10']}, {'input': '500 397 440\r\n202 1000\r\n75 1\r\n', 'output': ['43000']}]
[{'input': '5 4 0\r\n5 14\r\n1 -1\r\n', 'output': ['55']}, {'input': '2 2 0\r\n7 3\r\n1 1\r\n', 'output': ['6']}, {'input': '3 1 3\r\n1 2\r\n1 1\r\n', 'output': ['2']}, {'input': '500 397 440\r\n202 1000\r\n75 1\r\n', 'output': ['43000']}, {'input': '999 951 297\r\n62 106\r\n574 1\r\n', 'output': ['69324']}]
[{'input': '999 951 297\r\n62 106\r\n574 1\r\n', 'output': ['69324']}, {'input': '40 31 14\r\n628 1000\r\n36 1\r\n', 'output': ['17000']}, {'input': '600 443 587\r\n260 1000\r\n548 -1\r\n', 'output': ['144000']}, {'input': '100 20 83\r\n186 434\r\n64 -1\r\n', 'output': ['27342']}, {'input': '200 10 100\r\n1 100\r\n20 1\r\n', 'output': ['480']}]
[{'input': '5 4 0\r\n5 14\r\n1 -1\r\n', 'output': ['55']}, {'input': '10 1 9\r\n1 10\r\n1 1\r\n', 'output': ['8']}, {'input': '1000 711 437\r\n42 126\r\n745 1\r\n', 'output': ['34356']}, {'input': '5 3 0\r\n1 2\r\n4 -1\r\n', 'output': ['4']}, {'input': '100 9 6\r\n3 100\r\n5 1\r\n', 'output': ['300']}]
100
100
100
100
100
83.33
100
100
83.33
88.89
56
74
56
60
78
16
100
91.11
64.8
["4\n1 3\n2 3\n1 4\n5 3", "5\n1 2\n2 3\n3 4\n4 5\n5 1"]
The first line contains an integer m (0 ≀ m ≀ 10), which is the number of relations of acquaintances among the five friends of Igor's. Each of the following m lines contains two integers ai and bi (1 ≀ ai, bi ≀ 5;ai ≠ bi), where (ai, bi) is a pair of acquainted people. It is guaranteed that each pair of the acquaintances is described exactly once. The acquaintance relation is symmetrical, i.e. if x is acquainted with y, then y is also acquainted with x.
2bc18799c85ecaba87564a86a94e0322
#include<stdio.h> int main() { int i,j,k,a[100][100],n,x,y,flag=0; scanf("%d",&n); for(i=0;i<=5;i++) for(j=0;j<=5;j++) a[i][j]=0; for(i=0;i<n;i++) { scanf("%d%d",&x,&y); a[x][y]=1; a[y][x]=1; } for(i=1;i<=5;i++) for(j=i+1;j<=5;j++) for(k=j+1;k<=5;k++) { if(a[i][j]==1 && a[i][k]==1 && a[j][k]==1) flag=1; else if(a[i][j]!=1 && a[i][k]!=1 && a[j][k]!=1) flag=1; } if(flag==1) printf("WIN\n"); else printf("FAIL\n"); return 0; }
["WIN", "FAIL"]
C
null
Print "FAIL", if among those five people there are no either three pairwise acquainted or three pairwise unacquainted people. Otherwise print "WIN".
One day Igor K. stopped programming and took up math. One late autumn evening he was sitting at a table reading a book and thinking about something. The following statement caught his attention: "Among any six people there are either three pairwise acquainted people or three pairwise unacquainted people"Igor just couldn't get why the required minimum is 6 people. "Well, that's the same for five people, too!" β€” he kept on repeating in his mind. β€” "Let's take, say, Max, Ilya, Vova β€” here, they all know each other! And now let's add Dima and Oleg to Vova β€” none of them is acquainted with each other! Now, that math is just rubbish!"Igor K. took 5 friends of his and wrote down who of them is friends with whom. Now he wants to check whether it is true for the five people that among them there are either three pairwise acquainted or three pairwise not acquainted people.
[{"input": "4\r\n1 3\r\n2 3\r\n1 4\r\n5 3\r\n", "output": ["WIN"]}, {"input": "5\r\n1 2\r\n2 3\r\n3 4\r\n4 5\r\n5 1\r\n", "output": ["FAIL"]}, {"input": "1\r\n4 3\r\n", "output": ["WIN"]}, {"input": "6\r\n1 3\r\n2 3\r\n1 2\r\n5 3\r\n4 2\r\n4 5\r\n", "output": ["WIN"]}, {"input": "2\r\n1 3\r\n2 5\r\n", "output": ["WIN"]}, {"input": "3\r\n5 3\r\n4 3\r\n4 5\r\n", "output": ["WIN"]}, {"input": "5\r\n1 3\r\n3 2\r\n2 4\r\n5 4\r\n1 5\r\n", "output": ["FAIL"]}, {"input": "7\r\n1 3\r\n5 1\r\n1 4\r\n2 1\r\n5 3\r\n4 5\r\n2 5\r\n", "output": ["WIN"]}, {"input": "5\r\n5 1\r\n4 1\r\n2 3\r\n4 5\r\n3 1\r\n", "output": ["WIN"]}, {"input": "0\r\n", "output": ["WIN"]}, {"input": "10\r\n1 2\r\n1 3\r\n1 4\r\n1 5\r\n2 3\r\n2 4\r\n2 5\r\n3 4\r\n3 5\r\n4 5\r\n", "output": ["WIN"]}, {"input": "4\r\n1 2\r\n2 3\r\n3 4\r\n4 1\r\n", "output": ["WIN"]}, {"input": "1\r\n3 5\r\n", "output": ["WIN"]}, {"input": "1\r\n5 4\r\n", "output": ["WIN"]}, {"input": "2\r\n5 3\r\n1 3\r\n", "output": ["WIN"]}, {"input": "2\r\n3 4\r\n1 4\r\n", "output": ["WIN"]}, {"input": "2\r\n3 1\r\n2 3\r\n", "output": ["WIN"]}, {"input": "2\r\n4 5\r\n5 3\r\n", "output": ["WIN"]}, {"input": "3\r\n2 4\r\n1 4\r\n4 5\r\n", "output": ["WIN"]}, {"input": "3\r\n5 1\r\n4 1\r\n3 4\r\n", "output": ["WIN"]}, {"input": "3\r\n1 3\r\n5 3\r\n4 5\r\n", "output": ["WIN"]}, {"input": "3\r\n4 1\r\n1 5\r\n2 5\r\n", "output": ["WIN"]}, {"input": "3\r\n2 1\r\n3 1\r\n4 3\r\n", "output": ["WIN"]}, {"input": "3\r\n5 1\r\n3 1\r\n1 2\r\n", "output": ["WIN"]}, {"input": "4\r\n4 1\r\n4 2\r\n4 5\r\n3 5\r\n", "output": ["WIN"]}, {"input": "4\r\n5 1\r\n4 2\r\n1 2\r\n3 4\r\n", "output": ["WIN"]}, {"input": "4\r\n4 5\r\n3 5\r\n1 2\r\n4 2\r\n", "output": ["WIN"]}, {"input": "4\r\n5 3\r\n2 5\r\n3 1\r\n1 2\r\n", "output": ["WIN"]}, {"input": "4\r\n3 4\r\n5 4\r\n2 4\r\n3 1\r\n", "output": ["WIN"]}, {"input": "4\r\n5 1\r\n3 2\r\n5 3\r\n2 5\r\n", "output": ["WIN"]}, {"input": "4\r\n2 5\r\n2 3\r\n3 5\r\n1 4\r\n", "output": ["WIN"]}, {"input": "4\r\n1 2\r\n5 2\r\n3 5\r\n1 5\r\n", "output": ["WIN"]}, {"input": "5\r\n2 4\r\n3 1\r\n4 5\r\n5 3\r\n1 2\r\n", "output": ["FAIL"]}, {"input": "5\r\n5 1\r\n3 5\r\n1 2\r\n2 4\r\n4 3\r\n", "output": ["FAIL"]}, {"input": "5\r\n1 2\r\n2 3\r\n5 1\r\n4 5\r\n3 4\r\n", "output": ["FAIL"]}, {"input": "5\r\n2 1\r\n4 3\r\n1 5\r\n5 4\r\n3 2\r\n", "output": ["FAIL"]}, {"input": "5\r\n3 2\r\n1 4\r\n4 5\r\n5 3\r\n2 1\r\n", "output": ["FAIL"]}, {"input": "5\r\n1 3\r\n4 2\r\n3 4\r\n2 5\r\n5 1\r\n", "output": ["FAIL"]}, {"input": "5\r\n1 2\r\n2 5\r\n5 4\r\n4 3\r\n3 1\r\n", "output": ["FAIL"]}, {"input": "5\r\n1 4\r\n4 2\r\n2 5\r\n3 1\r\n5 3\r\n", "output": ["FAIL"]}, {"input": "5\r\n3 5\r\n2 4\r\n1 3\r\n5 2\r\n4 1\r\n", "output": ["FAIL"]}, {"input": "5\r\n1 2\r\n4 3\r\n5 1\r\n3 5\r\n2 4\r\n", "output": ["FAIL"]}, {"input": "5\r\n1 4\r\n5 4\r\n5 1\r\n3 4\r\n3 5\r\n", "output": ["WIN"]}, {"input": "5\r\n1 5\r\n3 4\r\n1 4\r\n5 4\r\n4 2\r\n", "output": ["WIN"]}, {"input": "5\r\n2 3\r\n4 3\r\n1 3\r\n5 2\r\n5 1\r\n", "output": ["WIN"]}, {"input": "5\r\n3 5\r\n4 5\r\n3 1\r\n1 5\r\n2 4\r\n", "output": ["WIN"]}, {"input": "5\r\n5 4\r\n3 4\r\n4 1\r\n3 5\r\n3 2\r\n", "output": ["WIN"]}, {"input": "5\r\n3 2\r\n5 4\r\n2 1\r\n1 5\r\n3 1\r\n", "output": ["WIN"]}, {"input": "5\r\n4 5\r\n5 3\r\n2 3\r\n3 1\r\n5 1\r\n", "output": ["WIN"]}, {"input": "5\r\n2 4\r\n1 3\r\n5 3\r\n3 2\r\n4 3\r\n", "output": ["WIN"]}, {"input": "5\r\n3 5\r\n4 2\r\n1 4\r\n3 4\r\n5 2\r\n", "output": ["WIN"]}, {"input": "5\r\n1 3\r\n1 4\r\n2 1\r\n4 3\r\n1 5\r\n", "output": ["WIN"]}, {"input": "5\r\n4 2\r\n5 2\r\n2 3\r\n1 3\r\n4 1\r\n", "output": ["WIN"]}, {"input": "5\r\n3 2\r\n5 3\r\n2 5\r\n1 4\r\n3 4\r\n", "output": ["WIN"]}, {"input": "5\r\n2 5\r\n1 3\r\n4 3\r\n2 1\r\n2 3\r\n", "output": ["WIN"]}, {"input": "5\r\n1 4\r\n4 2\r\n1 3\r\n3 4\r\n1 2\r\n", "output": ["WIN"]}, {"input": "5\r\n4 1\r\n5 2\r\n3 1\r\n4 3\r\n3 5\r\n", "output": ["WIN"]}, {"input": "5\r\n4 1\r\n5 1\r\n2 3\r\n2 5\r\n1 2\r\n", "output": ["WIN"]}, {"input": "5\r\n3 2\r\n3 1\r\n2 5\r\n1 5\r\n4 3\r\n", "output": ["WIN"]}, {"input": "5\r\n5 1\r\n5 3\r\n3 2\r\n4 5\r\n3 4\r\n", "output": ["WIN"]}, {"input": "5\r\n1 5\r\n2 1\r\n5 2\r\n2 4\r\n4 3\r\n", "output": ["WIN"]}, {"input": "5\r\n2 3\r\n1 4\r\n3 5\r\n1 5\r\n5 4\r\n", "output": ["WIN"]}, {"input": "6\r\n5 4\r\n5 1\r\n3 1\r\n2 3\r\n3 5\r\n2 4\r\n", "output": ["WIN"]}, {"input": "6\r\n5 4\r\n1 4\r\n4 2\r\n3 2\r\n5 1\r\n3 1\r\n", "output": ["WIN"]}, {"input": "6\r\n1 4\r\n2 1\r\n5 2\r\n3 5\r\n3 2\r\n2 4\r\n", "output": ["WIN"]}, {"input": "6\r\n1 5\r\n4 2\r\n1 3\r\n4 5\r\n2 1\r\n1 4\r\n", "output": ["WIN"]}, {"input": "6\r\n3 1\r\n5 2\r\n1 2\r\n2 3\r\n3 4\r\n4 2\r\n", "output": ["WIN"]}, {"input": "6\r\n4 5\r\n3 4\r\n2 4\r\n1 3\r\n2 3\r\n4 1\r\n", "output": ["WIN"]}, {"input": "6\r\n5 1\r\n4 2\r\n2 1\r\n4 1\r\n3 4\r\n3 2\r\n", "output": ["WIN"]}, {"input": "6\r\n3 2\r\n2 1\r\n2 4\r\n2 5\r\n5 3\r\n1 4\r\n", "output": ["WIN"]}, {"input": "7\r\n4 2\r\n3 1\r\n4 5\r\n3 2\r\n5 2\r\n5 3\r\n1 5\r\n", "output": ["WIN"]}, {"input": "7\r\n3 1\r\n1 2\r\n4 1\r\n4 5\r\n4 2\r\n2 3\r\n1 5\r\n", "output": ["WIN"]}, {"input": "7\r\n1 5\r\n1 4\r\n5 4\r\n5 3\r\n1 2\r\n2 3\r\n5 2\r\n", "output": ["WIN"]}, {"input": "7\r\n2 3\r\n3 4\r\n2 5\r\n4 5\r\n5 3\r\n5 1\r\n2 4\r\n", "output": ["WIN"]}, {"input": "7\r\n2 3\r\n2 1\r\n4 5\r\n5 2\r\n3 4\r\n3 1\r\n4 1\r\n", "output": ["WIN"]}, {"input": "7\r\n2 5\r\n2 1\r\n3 5\r\n1 4\r\n3 4\r\n4 5\r\n4 2\r\n", "output": ["WIN"]}, {"input": "8\r\n5 1\r\n5 3\r\n4 5\r\n3 4\r\n2 4\r\n1 3\r\n2 5\r\n2 3\r\n", "output": ["WIN"]}, {"input": "8\r\n4 3\r\n1 5\r\n4 1\r\n2 4\r\n2 5\r\n5 3\r\n1 3\r\n4 5\r\n", "output": ["WIN"]}, {"input": "8\r\n3 2\r\n3 1\r\n4 1\r\n2 4\r\n3 5\r\n1 5\r\n3 4\r\n1 2\r\n", "output": ["WIN"]}, {"input": "8\r\n3 4\r\n4 2\r\n4 5\r\n2 3\r\n3 5\r\n2 1\r\n1 5\r\n3 1\r\n", "output": ["WIN"]}, {"input": "9\r\n3 2\r\n5 1\r\n5 2\r\n2 1\r\n1 4\r\n1 3\r\n2 4\r\n5 3\r\n5 4\r\n", "output": ["WIN"]}, {"input": "9\r\n2 4\r\n3 2\r\n2 5\r\n4 5\r\n3 5\r\n1 3\r\n5 1\r\n1 2\r\n4 3\r\n", "output": ["WIN"]}, {"input": "3\r\n3 4\r\n4 5\r\n5 3\r\n", "output": ["WIN"]}, {"input": "3\r\n1 2\r\n1 3\r\n4 5\r\n", "output": ["WIN"]}, {"input": "3\r\n2 3\r\n3 5\r\n2 5\r\n", "output": ["WIN"]}, {"input": "1\r\n2 1\r\n", "output": ["WIN"]}, {"input": "1\r\n2 5\r\n", "output": ["WIN"]}, {"input": "2\r\n2 1\r\n1 5\r\n", "output": ["WIN"]}, {"input": "2\r\n4 2\r\n1 5\r\n", "output": ["WIN"]}, {"input": "2\r\n3 4\r\n5 2\r\n", "output": ["WIN"]}, {"input": "2\r\n1 5\r\n4 3\r\n", "output": ["WIN"]}, {"input": "3\r\n4 1\r\n4 5\r\n2 1\r\n", "output": ["WIN"]}, {"input": "3\r\n5 1\r\n5 3\r\n2 5\r\n", "output": ["WIN"]}, {"input": "3\r\n1 2\r\n4 2\r\n1 3\r\n", "output": ["WIN"]}, {"input": "3\r\n3 2\r\n1 5\r\n5 3\r\n", "output": ["WIN"]}, {"input": "3\r\n1 2\r\n2 4\r\n3 2\r\n", "output": ["WIN"]}, {"input": "3\r\n2 1\r\n1 3\r\n5 4\r\n", "output": ["WIN"]}, {"input": "4\r\n4 2\r\n2 5\r\n1 4\r\n4 5\r\n", "output": ["WIN"]}, {"input": "4\r\n5 2\r\n2 4\r\n5 3\r\n1 5\r\n", "output": ["WIN"]}, {"input": "4\r\n2 5\r\n1 3\r\n4 3\r\n4 2\r\n", "output": ["WIN"]}, {"input": "4\r\n1 4\r\n3 1\r\n2 3\r\n1 2\r\n", "output": ["WIN"]}, {"input": "4\r\n5 4\r\n2 3\r\n1 5\r\n5 2\r\n", "output": ["WIN"]}, {"input": "4\r\n2 5\r\n5 4\r\n1 4\r\n5 3\r\n", "output": ["WIN"]}, {"input": "4\r\n2 1\r\n2 4\r\n5 1\r\n4 1\r\n", "output": ["WIN"]}, {"input": "4\r\n1 2\r\n1 5\r\n4 5\r\n2 3\r\n", "output": ["WIN"]}, {"input": "5\r\n4 1\r\n2 4\r\n3 2\r\n5 3\r\n1 5\r\n", "output": ["FAIL"]}, {"input": "5\r\n1 3\r\n4 1\r\n5 2\r\n2 4\r\n3 5\r\n", "output": ["FAIL"]}, {"input": "5\r\n3 5\r\n4 2\r\n1 3\r\n2 1\r\n5 4\r\n", "output": ["FAIL"]}, {"input": "5\r\n5 2\r\n1 3\r\n4 5\r\n2 1\r\n3 4\r\n", "output": ["FAIL"]}, {"input": "5\r\n2 3\r\n3 5\r\n1 2\r\n4 1\r\n5 4\r\n", "output": ["FAIL"]}, {"input": "5\r\n1 2\r\n4 5\r\n5 3\r\n3 1\r\n2 4\r\n", "output": ["FAIL"]}, {"input": "5\r\n5 3\r\n3 2\r\n2 4\r\n1 5\r\n4 1\r\n", "output": ["FAIL"]}, {"input": "5\r\n3 2\r\n4 1\r\n2 5\r\n1 3\r\n5 4\r\n", "output": ["FAIL"]}, {"input": "5\r\n3 5\r\n1 4\r\n5 1\r\n2 3\r\n4 2\r\n", "output": ["FAIL"]}, {"input": "5\r\n4 2\r\n5 3\r\n2 1\r\n3 4\r\n1 5\r\n", "output": ["FAIL"]}, {"input": "5\r\n3 1\r\n5 1\r\n4 5\r\n2 4\r\n5 3\r\n", "output": ["WIN"]}, {"input": "5\r\n5 4\r\n5 3\r\n3 1\r\n1 4\r\n2 3\r\n", "output": ["WIN"]}, {"input": "5\r\n4 1\r\n3 5\r\n3 4\r\n5 4\r\n5 2\r\n", "output": ["WIN"]}, {"input": "5\r\n4 1\r\n5 2\r\n3 1\r\n4 2\r\n5 1\r\n", "output": ["WIN"]}, {"input": "5\r\n2 3\r\n1 5\r\n5 3\r\n2 4\r\n1 4\r\n", "output": ["FAIL"]}, {"input": "5\r\n5 4\r\n5 3\r\n2 3\r\n5 2\r\n5 1\r\n", "output": ["WIN"]}, {"input": "5\r\n2 4\r\n3 4\r\n1 4\r\n2 1\r\n3 2\r\n", "output": ["WIN"]}, {"input": "5\r\n2 3\r\n3 4\r\n1 3\r\n4 1\r\n5 2\r\n", "output": ["WIN"]}, {"input": "5\r\n1 2\r\n2 5\r\n4 2\r\n4 3\r\n3 1\r\n", "output": ["WIN"]}, {"input": "5\r\n2 1\r\n2 5\r\n4 5\r\n2 3\r\n3 5\r\n", "output": ["WIN"]}, {"input": "5\r\n4 1\r\n5 1\r\n5 4\r\n4 3\r\n5 2\r\n", "output": ["WIN"]}, {"input": "5\r\n1 3\r\n2 4\r\n1 5\r\n5 2\r\n4 1\r\n", "output": ["WIN"]}, {"input": "5\r\n1 5\r\n3 5\r\n2 3\r\n4 1\r\n3 1\r\n", "output": ["WIN"]}, {"input": "5\r\n5 2\r\n3 2\r\n2 1\r\n4 3\r\n4 2\r\n", "output": ["WIN"]}, {"input": "5\r\n1 3\r\n4 5\r\n3 4\r\n3 5\r\n5 1\r\n", "output": ["WIN"]}, {"input": "5\r\n4 5\r\n2 5\r\n5 3\r\n4 2\r\n4 1\r\n", "output": ["WIN"]}, {"input": "5\r\n2 5\r\n1 5\r\n1 3\r\n3 5\r\n1 2\r\n", "output": ["WIN"]}, {"input": "5\r\n2 4\r\n1 2\r\n5 2\r\n5 3\r\n4 5\r\n", "output": ["WIN"]}, {"input": "5\r\n2 1\r\n4 5\r\n5 3\r\n1 5\r\n1 4\r\n", "output": ["WIN"]}, {"input": "5\r\n1 3\r\n2 5\r\n4 2\r\n3 4\r\n4 1\r\n", "output": ["WIN"]}, {"input": "6\r\n3 2\r\n2 4\r\n3 1\r\n3 5\r\n5 2\r\n1 2\r\n", "output": ["WIN"]}, {"input": "6\r\n2 1\r\n5 1\r\n5 4\r\n3 5\r\n3 4\r\n4 1\r\n", "output": ["WIN"]}, {"input": "6\r\n3 1\r\n1 4\r\n5 4\r\n2 1\r\n4 2\r\n1 5\r\n", "output": ["WIN"]}, {"input": "6\r\n5 1\r\n5 4\r\n3 4\r\n1 3\r\n1 4\r\n4 2\r\n", "output": ["WIN"]}, {"input": "6\r\n1 3\r\n5 4\r\n4 2\r\n2 1\r\n4 1\r\n2 3\r\n", "output": ["WIN"]}, {"input": "6\r\n4 3\r\n5 3\r\n4 1\r\n1 3\r\n1 2\r\n2 4\r\n", "output": ["WIN"]}, {"input": "6\r\n4 1\r\n3 5\r\n4 5\r\n3 1\r\n4 3\r\n5 2\r\n", "output": ["WIN"]}, {"input": "6\r\n2 1\r\n1 4\r\n4 5\r\n5 2\r\n1 3\r\n3 2\r\n", "output": ["WIN"]}, {"input": "7\r\n5 1\r\n3 5\r\n2 5\r\n4 5\r\n2 3\r\n3 1\r\n4 3\r\n", "output": ["WIN"]}, {"input": "7\r\n5 3\r\n5 1\r\n4 2\r\n4 5\r\n3 2\r\n3 4\r\n1 3\r\n", "output": ["WIN"]}, {"input": "7\r\n3 5\r\n1 4\r\n5 2\r\n1 5\r\n1 3\r\n4 2\r\n4 3\r\n", "output": ["WIN"]}, {"input": "7\r\n5 1\r\n5 4\r\n2 4\r\n2 3\r\n3 5\r\n2 5\r\n4 1\r\n", "output": ["WIN"]}, {"input": "7\r\n1 3\r\n2 5\r\n4 3\r\n2 1\r\n2 3\r\n4 5\r\n2 4\r\n", "output": ["WIN"]}, {"input": "7\r\n3 1\r\n4 5\r\n3 5\r\n5 1\r\n2 4\r\n1 2\r\n1 4\r\n", "output": ["WIN"]}, {"input": "8\r\n1 5\r\n3 1\r\n2 5\r\n4 2\r\n2 1\r\n4 5\r\n4 3\r\n4 1\r\n", "output": ["WIN"]}, {"input": "8\r\n4 2\r\n3 1\r\n4 3\r\n2 5\r\n3 2\r\n4 5\r\n1 2\r\n3 5\r\n", "output": ["WIN"]}, {"input": "8\r\n2 4\r\n3 2\r\n2 5\r\n3 4\r\n3 1\r\n5 1\r\n4 5\r\n5 3\r\n", "output": ["WIN"]}, {"input": "8\r\n2 3\r\n1 5\r\n1 3\r\n4 5\r\n2 4\r\n1 4\r\n3 5\r\n3 4\r\n", "output": ["WIN"]}, {"input": "9\r\n3 5\r\n3 2\r\n1 5\r\n4 3\r\n5 4\r\n1 4\r\n1 3\r\n4 2\r\n5 2\r\n", "output": ["WIN"]}, {"input": "9\r\n3 5\r\n2 5\r\n5 1\r\n4 5\r\n1 3\r\n3 2\r\n1 4\r\n4 3\r\n4 2\r\n", "output": ["WIN"]}]
100
100
100
[{'input': '7\r\n2 3\r\n2 1\r\n4 5\r\n5 2\r\n3 4\r\n3 1\r\n4 1\r\n', 'output': ['WIN']}, {'input': '4\r\n1 2\r\n5 2\r\n3 5\r\n1 5\r\n', 'output': ['WIN']}, {'input': '9\r\n3 2\r\n5 1\r\n5 2\r\n2 1\r\n1 4\r\n1 3\r\n2 4\r\n5 3\r\n5 4\r\n', 'output': ['WIN']}, {'input': '4\r\n4 2\r\n2 5\r\n1 4\r\n4 5\r\n', 'output': ['WIN']}, {'input': '6\r\n3 1\r\n5 2\r\n1 2\r\n2 3\r\n3 4\r\n4 2\r\n', 'output': ['WIN']}]
[{'input': '5\r\n1 2\r\n2 5\r\n5 4\r\n4 3\r\n3 1\r\n', 'output': ['FAIL']}, {'input': '1\r\n4 3\r\n', 'output': ['WIN']}, {'input': '5\r\n1 2\r\n2 5\r\n4 2\r\n4 3\r\n3 1\r\n', 'output': ['WIN']}, {'input': '3\r\n5 1\r\n5 3\r\n2 5\r\n', 'output': ['WIN']}, {'input': '6\r\n4 3\r\n5 3\r\n4 1\r\n1 3\r\n1 2\r\n2 4\r\n', 'output': ['WIN']}]
[{'input': '9\r\n2 4\r\n3 2\r\n2 5\r\n4 5\r\n3 5\r\n1 3\r\n5 1\r\n1 2\r\n4 3\r\n', 'output': ['WIN']}, {'input': '7\r\n3 1\r\n4 5\r\n3 5\r\n5 1\r\n2 4\r\n1 2\r\n1 4\r\n', 'output': ['WIN']}, {'input': '8\r\n1 5\r\n3 1\r\n2 5\r\n4 2\r\n2 1\r\n4 5\r\n4 3\r\n4 1\r\n', 'output': ['WIN']}, {'input': '5\r\n3 5\r\n4 2\r\n1 3\r\n2 1\r\n5 4\r\n', 'output': ['FAIL']}, {'input': '0\r\n', 'output': ['WIN']}]
[{'input': '5\r\n3 5\r\n4 2\r\n1 4\r\n3 4\r\n5 2\r\n', 'output': ['WIN']}, {'input': '6\r\n5 1\r\n5 4\r\n3 4\r\n1 3\r\n1 4\r\n4 2\r\n', 'output': ['WIN']}, {'input': '3\r\n5 1\r\n3 1\r\n1 2\r\n', 'output': ['WIN']}, {'input': '4\r\n5 4\r\n2 3\r\n1 5\r\n5 2\r\n', 'output': ['WIN']}, {'input': '4\r\n5 2\r\n2 4\r\n5 3\r\n1 5\r\n', 'output': ['WIN']}]
[{'input': '5\r\n1 4\r\n4 2\r\n2 5\r\n3 1\r\n5 3\r\n', 'output': ['FAIL']}, {'input': '6\r\n3 1\r\n1 4\r\n5 4\r\n2 1\r\n4 2\r\n1 5\r\n', 'output': ['WIN']}, {'input': '5\r\n3 5\r\n1 4\r\n5 1\r\n2 3\r\n4 2\r\n', 'output': ['FAIL']}, {'input': '5\r\n2 3\r\n1 4\r\n3 5\r\n1 5\r\n5 4\r\n', 'output': ['WIN']}, {'input': '5\r\n4 1\r\n2 4\r\n3 2\r\n5 3\r\n1 5\r\n', 'output': ['FAIL']}]
100
100
100
100
100
94.44
100
100
94.44
100
96.15
100
100
96.15
100
17
100
97.776
98.46
["100\n15 20 20 15 10 30 45", "2\n1 0 0 0 0 0 0"]
The first input line contains the single integer n (1 ≀ n ≀ 1000) β€” the number of pages in the book. The second line contains seven non-negative space-separated integers that do not exceed 1000 β€” those integers represent how many pages Petr can read on Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday correspondingly. It is guaranteed that at least one of those numbers is larger than zero.
007a779d966e2e9219789d6d9da7002c
#include<stdio.h> int main() { int i,j,t,a,b,page, sum =0; int day[8]; scanf ("%d",&page); for(i=1; i<8; i++){ scanf("%d", &day[i]); } j = 0; while(1){ j++; sum = sum + day[j]; if(sum >= page){ printf("%d\n", j); break; } else if(j==7){ j = 0; } } }
["6", "1"]
C
NoteNote to the first sample:By the end of Monday and therefore, by the beginning of Tuesday Petr has 85 pages left. He has 65 pages left by Wednesday, 45 by Thursday, 30 by Friday, 20 by Saturday and on Saturday Petr finishes reading the book (and he also has time to read 10 pages of something else).Note to the second sample:On Monday of the first week Petr will read the first page. On Monday of the second week Petr will read the second page and will finish reading the book.
Print a single number β€” the number of the day of the week, when Petr will finish reading the book. The days of the week are numbered starting with one in the natural order: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.
One Sunday Petr went to a bookshop and bought a new book on sports programming. The book had exactly n pages.Petr decided to start reading it starting from the next day, that is, from Monday. Petr's got a very tight schedule and for each day of the week he knows how many pages he will be able to read on that day. Some days are so busy that Petr will have no time to read whatsoever. However, we know that he will be able to read at least one page a week.Assuming that Petr will not skip days and will read as much as he can every day, determine on which day of the week he will read the last page of the book.
[{"input": "100\r\n15 20 20 15 10 30 45\r\n", "output": ["6"]}, {"input": "2\r\n1 0 0 0 0 0 0\r\n", "output": ["1"]}, {"input": "100\r\n100 200 100 200 300 400 500\r\n", "output": ["1"]}, {"input": "3\r\n1 1 1 1 1 1 1\r\n", "output": ["3"]}, {"input": "1\r\n1 1 1 1 1 1 1\r\n", "output": ["1"]}, {"input": "20\r\n5 3 7 2 1 6 4\r\n", "output": ["6"]}, {"input": "10\r\n5 1 1 1 1 1 5\r\n", "output": ["6"]}, {"input": "50\r\n10 1 10 1 10 1 10\r\n", "output": ["1"]}, {"input": "77\r\n11 11 11 11 11 11 10\r\n", "output": ["1"]}, {"input": "1\r\n1000 1000 1000 1000 1000 1000 1000\r\n", "output": ["1"]}, {"input": "1000\r\n100 100 100 100 100 100 100\r\n", "output": ["3"]}, {"input": "999\r\n10 20 10 20 30 20 10\r\n", "output": ["3"]}, {"input": "433\r\n109 58 77 10 39 125 15\r\n", "output": ["7"]}, {"input": "1\r\n0 0 0 0 0 0 1\r\n", "output": ["7"]}, {"input": "5\r\n1 0 1 0 1 0 1\r\n", "output": ["1"]}, {"input": "997\r\n1 1 0 0 1 0 1\r\n", "output": ["1"]}, {"input": "1000\r\n1 1 1 1 1 1 1\r\n", "output": ["6"]}, {"input": "1000\r\n1000 1000 1000 1000 1000 1000 1000\r\n", "output": ["1"]}, {"input": "1000\r\n1 0 0 0 0 0 0\r\n", "output": ["1"]}, {"input": "1000\r\n0 0 0 0 0 0 1\r\n", "output": ["7"]}, {"input": "1000\r\n1 0 0 1 0 0 1\r\n", "output": ["1"]}, {"input": "509\r\n105 23 98 0 7 0 155\r\n", "output": ["2"]}, {"input": "7\r\n1 1 1 1 1 1 1\r\n", "output": ["7"]}, {"input": "2\r\n1 1 0 0 0 0 0\r\n", "output": ["2"]}, {"input": "1\r\n0 0 0 0 0 1 0\r\n", "output": ["6"]}, {"input": "10\r\n0 0 0 0 0 0 1\r\n", "output": ["7"]}, {"input": "5\r\n0 0 0 0 0 6 0\r\n", "output": ["6"]}, {"input": "3\r\n0 1 0 0 0 0 0\r\n", "output": ["2"]}, {"input": "10\r\n0 0 0 0 0 0 10\r\n", "output": ["7"]}, {"input": "28\r\n1 2 3 4 5 6 7\r\n", "output": ["7"]}, {"input": "100\r\n5 5 5 5 5 5 5\r\n", "output": ["6"]}, {"input": "4\r\n1 0 0 0 0 0 1\r\n", "output": ["7"]}, {"input": "2\r\n0 0 0 0 0 0 1\r\n", "output": ["7"]}, {"input": "7\r\n0 0 0 0 0 0 7\r\n", "output": ["7"]}, {"input": "7\r\n2 1 1 1 1 1 0\r\n", "output": ["6"]}, {"input": "2\r\n0 0 1 1 0 0 0\r\n", "output": ["4"]}, {"input": "6\r\n1 1 1 1 1 1 0\r\n", "output": ["6"]}, {"input": "5\r\n1 1 1 0 0 1 1\r\n", "output": ["7"]}, {"input": "100\r\n10 20 30 10 10 10 10\r\n", "output": ["7"]}, {"input": "1\r\n0 0 0 1 0 0 0\r\n", "output": ["4"]}, {"input": "70\r\n10 10 10 10 10 10 10\r\n", "output": ["7"]}, {"input": "22\r\n1 2 3 4 5 6 10\r\n", "output": ["7"]}, {"input": "5\r\n0 0 0 1 0 0 0\r\n", "output": ["4"]}, {"input": "2\r\n0 0 0 1 0 0 0\r\n", "output": ["4"]}, {"input": "6\r\n1 0 0 0 0 0 2\r\n", "output": ["7"]}, {"input": "10\r\n1 2 2 1 2 1 1\r\n", "output": ["7"]}, {"input": "5\r\n0 0 0 0 0 0 10\r\n", "output": ["7"]}, {"input": "4\r\n0 1 1 0 0 0 0\r\n", "output": ["3"]}, {"input": "100\r\n0 0 0 0 0 1 0\r\n", "output": ["6"]}]
100
100
100
[{'input': '3\r\n0 1 0 0 0 0 0\r\n', 'output': ['2']}, {'input': '997\r\n1 1 0 0 1 0 1\r\n', 'output': ['1']}, {'input': '3\r\n1 1 1 1 1 1 1\r\n', 'output': ['3']}, {'input': '4\r\n0 1 1 0 0 0 0\r\n', 'output': ['3']}, {'input': '5\r\n1 0 1 0 1 0 1\r\n', 'output': ['1']}]
[{'input': '5\r\n0 0 0 0 0 0 10\r\n', 'output': ['7']}, {'input': '28\r\n1 2 3 4 5 6 7\r\n', 'output': ['7']}, {'input': '5\r\n1 1 1 0 0 1 1\r\n', 'output': ['7']}, {'input': '1\r\n1000 1000 1000 1000 1000 1000 1000\r\n', 'output': ['1']}, {'input': '10\r\n0 0 0 0 0 0 10\r\n', 'output': ['7']}]
[{'input': '5\r\n0 0 0 1 0 0 0\r\n', 'output': ['4']}, {'input': '6\r\n1 1 1 1 1 1 0\r\n', 'output': ['6']}, {'input': '2\r\n0 0 0 0 0 0 1\r\n', 'output': ['7']}, {'input': '70\r\n10 10 10 10 10 10 10\r\n', 'output': ['7']}, {'input': '1000\r\n1 1 1 1 1 1 1\r\n', 'output': ['6']}]
[{'input': '4\r\n1 0 0 0 0 0 1\r\n', 'output': ['7']}, {'input': '2\r\n0 0 1 1 0 0 0\r\n', 'output': ['4']}, {'input': '433\r\n109 58 77 10 39 125 15\r\n', 'output': ['7']}, {'input': '7\r\n1 1 1 1 1 1 1\r\n', 'output': ['7']}, {'input': '2\r\n1 0 0 0 0 0 0\r\n', 'output': ['1']}]
[{'input': '999\r\n10 20 10 20 30 20 10\r\n', 'output': ['3']}, {'input': '10\r\n0 0 0 0 0 0 1\r\n', 'output': ['7']}, {'input': '3\r\n0 1 0 0 0 0 0\r\n', 'output': ['2']}, {'input': '433\r\n109 58 77 10 39 125 15\r\n', 'output': ['7']}, {'input': '1000\r\n0 0 0 0 0 0 1\r\n', 'output': ['7']}]
100
100
100
100
100
100
92.31
100
100
100
100
83.33
100
100
100
18
100
98.462
96.666
["2 2", "9 3"]
The single line contains two integers n and m (1 ≀ n ≀ 100;Β 2 ≀ m ≀ 100), separated by a space.
42b25b7335ec01794fbb1d4086aa9dd0
#include<stdio.h> int main() { int n,m,sum,d; scanf("%d %d",&n,&m); sum=n; rich: d=n/m; if(d>0) { sum=sum+d; if(((n%m)+d)>=m) { n=(n%m)+d; goto rich; } } printf("%d",sum); return 0; }
["3", "13"]
C
NoteIn the first sample Vasya spends the first two days wearing the socks that he had initially. Then on day three he puts on the socks that were bought on day two.In the second sample Vasya spends the first nine days wearing the socks that he had initially. Then he spends three days wearing the socks that were bought on the third, sixth and ninth days. Than he spends another day wearing the socks that were bought on the twelfth day.
Print a single integer β€” the answer to the problem.
Vasya has n pairs of socks. In the morning of each day Vasya has to put on a pair of socks before he goes to school. When he comes home in the evening, Vasya takes off the used socks and throws them away. Every m-th day (at days with numbers m, 2m, 3m, ...) mom buys a pair of socks to Vasya. She does it late in the evening, so that Vasya cannot put on a new pair of socks before the next day. How many consecutive days pass until Vasya runs out of socks?
[{"input": "2 2\r\n", "output": ["3"]}, {"input": "9 3\r\n", "output": ["13"]}, {"input": "1 2\r\n", "output": ["1"]}, {"input": "2 3\r\n", "output": ["2"]}, {"input": "1 99\r\n", "output": ["1"]}, {"input": "4 4\r\n", "output": ["5"]}, {"input": "10 2\r\n", "output": ["19"]}, {"input": "10 9\r\n", "output": ["11"]}, {"input": "100 100\r\n", "output": ["101"]}, {"input": "2 27\r\n", "output": ["2"]}, {"input": "99 100\r\n", "output": ["99"]}, {"input": "99 2\r\n", "output": ["197"]}, {"input": "100 3\r\n", "output": ["149"]}, {"input": "98 3\r\n", "output": ["146"]}, {"input": "100 2\r\n", "output": ["199"]}, {"input": "62 4\r\n", "output": ["82"]}, {"input": "99 10\r\n", "output": ["109"]}, {"input": "100 5\r\n", "output": ["124"]}, {"input": "80 80\r\n", "output": ["81"]}, {"input": "95 16\r\n", "output": ["101"]}, {"input": "75 16\r\n", "output": ["79"]}, {"input": "99 74\r\n", "output": ["100"]}, {"input": "20 21\r\n", "output": ["20"]}, {"input": "52 96\r\n", "output": ["52"]}, {"input": "24 5\r\n", "output": ["29"]}]
100
100
100
[{'input': '98 3\r\n', 'output': ['146']}, {'input': '62 4\r\n', 'output': ['82']}, {'input': '1 99\r\n', 'output': ['1']}, {'input': '99 100\r\n', 'output': ['99']}, {'input': '2 3\r\n', 'output': ['2']}]
[{'input': '99 2\r\n', 'output': ['197']}, {'input': '99 74\r\n', 'output': ['100']}, {'input': '2 2\r\n', 'output': ['3']}, {'input': '2 3\r\n', 'output': ['2']}, {'input': '100 2\r\n', 'output': ['199']}]
[{'input': '20 21\r\n', 'output': ['20']}, {'input': '99 10\r\n', 'output': ['109']}, {'input': '99 74\r\n', 'output': ['100']}, {'input': '10 2\r\n', 'output': ['19']}, {'input': '100 3\r\n', 'output': ['149']}]
[{'input': '62 4\r\n', 'output': ['82']}, {'input': '98 3\r\n', 'output': ['146']}, {'input': '1 2\r\n', 'output': ['1']}, {'input': '99 74\r\n', 'output': ['100']}, {'input': '100 100\r\n', 'output': ['101']}]
[{'input': '2 3\r\n', 'output': ['2']}, {'input': '100 2\r\n', 'output': ['199']}, {'input': '2 27\r\n', 'output': ['2']}, {'input': '75 16\r\n', 'output': ['79']}, {'input': '100 100\r\n', 'output': ['101']}]
100
100
100
100
100
100
100
100
100
100
100
100
100
100
100
19
100
100
100
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
63
Edit dataset card