| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 10066 | I2P homework2a |
|
| 10739 | Binary addition |
|
| 11151 | rectangle intersection |
|
| 11533 | Christmas tree |
|
| 11622 | pF - Full House |
|
| 11857 | Another Spiral |
|
| 11862 | getchar practice |
|
| 11869 | Word Scramble |
|
Description
The input is a three-digit integer N that consists of digits 1-9 except 0. For example, 489 is such a number. The task is to reverse the order of the digits of N to get a new three-digit number M, and compute the average of the N and M. For example, if N is 489, then M is 984, and the answer should be 736.5.
Input
A three-digit integer consisting of 1-9 except 0
Output
The average of the input number and its reversal
The answer should be expressed as a floating point number with precision to the first decimal place. For example, 333.0 or 736.5
Note that you do not need to print ‘\n’ at the end of the output.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Problem Description
Given a positive integer N, transform it to its unsigned binary representation (e.g. 10 => 1010). Your program needs to output the binary representation of N+1 and the number of carries during the addition in binary representation.
For example, if the input is 11 (in decimal), your program needs to output 1100, because it is the binary representation of 11+1=12. Also your program needs to output 2, because during the binary addition of 11+1, there are two carries generated.
1011 (11 in binary)
+ 0001 (1 in binary)
---------------------------------
1100 (12 in binary)
Input
The input consist of an integer N (0 <= N <= 1024)
Output
The binary representation of N+1 and the number of carries during the binary addition of N+1. Those two numbers are separated by a space. Note that you do not need to print ‘\n’ at the end of the output.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
According to Wikipedia, the definition of rectangle is as follows: "In Euclidean plane geometry, a rectangle is a quadrilateral(四邊形) with four right angles(直角). It can also be defined as an equiangular quadrilateral, since equiangular means that all of its angles are equal (360°/4 = 90°)."
In this problem, you are asked to calculate the number of rectangle pairs that intersect to each other among a set of given rectangles. All rectangles are located in a 2-dimensional euclidean space(二維空間), and all their edges are parallel to either the X- or the Y-axis.
Input
The first line contains one number N, where 2 <= N <= 128, standing for the number of given rectangles.
Each of the following N lines describes a rectangle and has 4 integers separated by space, representing
- the x coordinate of the bottom-left vertex
- the y coordinate of the bottom-left vertex
- the width (the length of the edge that is parallel to the x-axis), positive
- the height (the length of the edge that is parallel to the y-axis), positive
Notice that each of the 4 numbers is representable by an int type in C language.
Output
The output should contain only one number, representing the number of rectangle pairs that intersect to each other.
Notice that if the area of overlapping part is zero, then the pair should NOT count.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
請印出聖誕樹
Input
會給3個數字level, width, height
level: 表示樹葉部份的層數,每層為上一層加2(e.g. 1 3 5 7 ...), 1 <= level <= 20
width: 表示樹木的寬度,寬度只會是奇數, 1 <= width <= 39
height: 表示樹木的高度,0 <= height <= 9
Output
請參考sample IO (可以載下來觀看),樹木的寬度可能會超過樹葉部份的寬度,請以最寬的部份為基準,碰在畫面最左邊(如果height是0,不影響畫的位置),樹木的中心點會剛好對應整棵樹的中心點(整棵樹左右會對稱)
每行最右邊的'*'號,請接換行符號('\n'),不要輸出多餘的符號如空白' '
sample IO共有4個例子,用'---'做區隔,實際的IO只會有三個數字,並且只需要輸出一次聖誕樹即可
Sample Input Download
Sample Output Download
Tags
Discuss
Description
The "Mannulus" casino is now celebrating its grand opening in Canterlot! The owner, Lightyear, introduces the cutting-edge technology to the casino : Farseer Cards Auto Detect System. If it works well, the casino will no longer need to employ any dealer!
The question is : the system cannot automatically rank the cards in the correct order. So Lightyear decides to hire a group of programmers to improve the whole system. You, as a beginning programmer, is assigned to write a program to check whether a set of five cards forms a full house or not. Lightyear will then give you T sets of cards to verify the correctness of your program.
Do not disappoint him.
** For someone who doesn't know the definition of full house : https://en.wikipedia.org/wiki/List_of_poker_hands#Full_house
Input
The first line contains an integer T, representing the number of sets Lightyear gives to you.
The next T lines contain 5 cards in each given set, separated by whitespaces.
The cards would range from : {A, 2, 3, 4, 5, 6, 7, 8 ,9 ,10, J, Q, K}.
(In this problem, you don't need to consider the suit of each card.)
-
1 ≤ | T | ≤ 10000
Output
For each set of card, please print 'YES' if the set is a full house, otherwise please print 'NO'.
Remember to print '\n' after each answer.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
In this problem, you are asked to output a sequence of integer number (i.e. 0, 1, 2, 3 ......) in the "spiral form".
A square is an area with NxN grids. You put the first number (i.e. 0) in the position according to the input. Then, you put the next number to the right (or left) of the previous one, and you will reach the right (or left) border of the square. Any time you can't find an empty place on current direction, you turn "right" (or "left") and place the next number until your direction is opposite to origin direction which you reach this grid.
Sample IO shows four testcases, your input has only four integer and output N*N number.
Input
There are four integer numbers for the input. The first number N (1<= N <= 20) denotes the size of the edges of the square. The second number decides the direction of this case (0 means clockwise, and 1 means anticlockwise). The third and forth number mean the initial position in which row and column.
Output
Print the content in the square. There should be N lines in the output.
If the gird is not reached, the content should be 0. (note: the content of initial position is also 0)
note: print a space before each number, and print '\n' in the end of each line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
In this practice,you need to write a function isNumber to determine whether the composition of the input strings are all 0~9 or all a~z.
isNumber function returns 1 if the composition of the input string is all 0~9.
isNumber function returns 0 if the composition of the input string is all a~z.
You should use getchar() to get all characters of input string, and remember to return it to stdin because we will get the input string again using scanf in judgeA and judgeB functions.
Note that
1. This problem involves three files.
- function.h: Function definition of isNumber and other functions.
- function.c: Function describe of isNumber.
- main.c: A driver program to test your implementation and describe of other functions.
You will be provided with main.c and function.h, and asked to implement function.c.
2. For OJ submission:
Step 1. Submit only your function.c into the submission block.
Step 2. Check the results and debug your program if necessary.
hint: the format of function.c should be like:
#include<stdio.h>
int isNumber(){
// write your code here...
}
Input
Input is a number in the first line and then some strings in the next several lines. The number N(1<=N<=10) in the first line denotes the number of input strings. There are just two types of input string: all 0~9 & all a~z(not include capital letter), and the size of each string is not larger than 100.
Output
There should be N lines in the output.
At each line, print "OK!Number" if the composition of the string is all 0~9.
Print "OK!Word" if the composition of the string is all a~z.
Note that:
In this problem, you don't need to write printf() function because it has been already written in main.c.
You only need to return 0 or 1 in isNumber() function.
Sample Input Download
Sample Output Download
Partial Judge Code
11862.cPartial Judge Header
11862.hTags
Discuss
Description
Write a program that will reverse the letters in each of a sequence of words while preserving the order of the words themselves.
We suggest you to use fgets() (gets() cannot be used safely and gets_s() is optional in C11)
Hint: the usage of fgets() in this problem would look like while(fgets(string, n , stdin) != NULL)
Input
The input file will consist of several lines of several words. Words are contiguous stretches of printable characters delimited by white space.
The length of each line is smaller than 350.
Output
The output will consist of the same lines and words as the input file. However, the letters within each word must be reversed.
If the input is "I love you.", the output should be "I evol .uoy"