| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 10728 | A simple set problem |
|
| 11101 | Big Number |
|
| 11583 | EECS_LAB_1 |
|
Description
Out of the N NTHU 2015 Computer Science (CS) majors, X of them take the course CS13550* Introduction to Programming (I), Y of them take the course CL10100* College Chinese, and Z of them take none of the two courses (i.e., CS13550* and CL10100*). How many NTHU 2015 CS majors take both of the two courses? And how many take CS13550* but not CL10100*?
Input
Four integers N, X, Y, Z which are separated by blanks. Note that 0<N<1000, 0<X<1000, 0<Y<1000 and 0<Z<1000.
Output
Two integers separated by a blank. The first integer is the number of NTHU 2015 CS majors who take both CS13550* and CL10100*, and the second one is the number of NTHU 2015 CS majors who take CS13550* but not CL10100*. Note that you do not need to print '\n' at the end of the output.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Replace the ??? in the following code so that the program can correctly compute
the square of the number entered by the user.
Assume that the input number is always an 8-digit positive integer.
* Note that the output format is always 16-digit wide with space prepended if needed.
For example,
(11111111)^2 = _123456787654321
_ is a space character.
#include <stdio.h>
/* 2016/09/22 */
int first4(int x){
return x/10000;
}
int last4(int x){
/* The operator % in C computes the remainder after division.
For example, the answer of 23%7 will be 2.*/
return x%10000;
}
int first8(int x){
return x/100000000;
}
int last8(int x){
return x%100000000;
}
int shift4(int x){
return x*10000;
}
int main(void){
int x;
int a, b;
int c1, c2, c3;
/* Assume that the input is always an 8-digit positive integer. */
scanf("%d", ???);
a = first4(x);
b = last4(x)
c3 = ???;
c2 = ???;
c1 = ???;
printf("%4d%08d%04d", ???, ???, ???);
/* %04d will display a 4-digit number and add 0 as padding before the number if necessary */
return 0;
}
Assume that the input 8-digit integer
x can be expressed by a*10000 + b .The square of x can be expressed as a*a*100000000 + 2*a*b*10000 + b*b .We may partition the computation into three parts.
Input
The input is always an 8-digit positive integer
Output
the square of input .
Note that you do not need to print ‘\n’ at the end of the output.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
The input is a four-digit positive integer x that consists of digits 1-9 except 0. Let y be the number with the first two digits and the rest of x swapped. For example, if x is 9527, then y is 2795. Now, calculate z, which is the square of y, and encode z by the following mapping:
1->’A’, 2->’B’, 3->’C’, …, 9->’I’, 0->’J’
You should pad 0 on the left of z to make z an eight-digit number before encoding.
That is, since y is 2795 and its square z is 7812025, the padded version of z is 07812025, and so your answer should be JGHABJBE.
Input
A four-digit positive integer consisting of 1-9 except 0.
Output
The encoded z. Note that you do need to print ‘\n’ at the end of the output.