# | Problem | Pass Rate (passed user / total user) |
---|---|---|
14699 | Calculation of days |
|
14700 | Carry system conversion |
|
14702 | Print out values in sequence |
|
14703 | Average score |
|
Description
Write a program to calculate the number of days from January 1, 1970 to a specific date. If the date is invalid or earlier than January 1, 1970, output 0.
Rules of leap year:
-
A year not divisible by 4 is a common year.
-
A year divisible by 4 but not divisible by 100 is a leap year.
-
A year divisible by 400 is a leap year.
-
A year divisible by 1000 is a leap year.
Input
A date.
Ex. 1970
1
5
Output
The amout of days.
Ex. 5
Sample Input Download
Sample Output Download
Discuss
Description
Write a program to perform number conversion between binary, octal, and decimal.
The first input number indicates the input format: 2
for binary, 10
for decimal, 8
for octal.
The second input number n
indicates how many digits the number has.
The next n
numbers are the digits of the input number from left to right.
The last number indicates the output format, same as the first number.
For example, converting 12345
in decimal to octal results in 30071
. Note that the output must print one digit per line.
Input
The input format. Ex. 2 for binary, 10 for decibal, 6 for octal.
Digits of the number. Ex. 5
digits of the input number from left to right. Ex. 1
2
3
4
5
The output format. Ex. 8
Output
The converted result.
Must be printed one digit per line.
Ex. 3
0
0
7
1
Sample Input Download
Sample Output Download
Discuss
Description
Write a program that prints a sequence according to odd and even positions.
The first line of input is the length n of the sequence, and the second line contains the numbers of the sequence.
The output has two lines: the first line contains the first, third, fifth, and so on numbers in the sequence, and the second line contains the second, fourth, sixth, and so on numbers.
There is a space between the numbers on the same line.
Input
First line: The length of the sequence. Ex. 5
Second line: The numbers of the sequence. Ex. 1 2 3 4 5
Output
The odd digits of the sequence. Ex. 1 3 5
The even digits of the sequence. Ex. 2 4
Sample Input Download
Sample Output Download
Discuss
Description
Write a program to calculate average scores.
Suppose there are s students taking the same c courses. The program should compute the average score for each student, as well as the average score for each course across all students.
-
Input:
- The first line contains two integers: s and c.
-
The following s lines each represent one student’s scores. Each line contains c numbers, where the j-th number represents that student’s score in the j-th course.
-
Output:
-
A total of s + c lines.
-
The first s lines each contain the average score of one student.
-
The next c lines each contain the average score of one course across all students.
-
-
Constraints:
-
0 < s ≤ 100
-
0 < c ≤ 100
-
Input
First line: s, c.
Following s lines each represent one student's score, c represents the student's score in the j-th course.
Ex. 3 4
87 89 97 89
78 100 76 98
99 90 89 94
Output
A total of s + c lines.
The first s lines each contain the average score of one student.
The next c lines each contain the average score of one course across all students.
Ex. 90
88
93
88
93
87
93