题目链接:
huangjing
hdu5054 Alice and Bob
思路:
就是(x,y)在两个参考系中的表示演完全一样。那么只可能在这个矩形的中点。。
题目:
Alice and Bob Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 216 Accepted Submission(s): 166
Problem Description
Bob and Alice got separated in the Square, they agreed that if they get separated, they'll meet back at the coordinate point (x, y). Unfortunately they forgot to define the origin of coordinates and the coordinate axis direction. Now, Bob in the lower left corner of the Square, Alice in the upper right corner of the the Square. Bob regards the lower left corner as the origin of coordinates, rightward for positive direction of axis X, upward for positive direction of axis Y. Alice regards the upper right corner as the origin of coordinates, leftward for positive direction of axis X, downward for positive direction of axis Y. Assuming that Square is a rectangular, length and width size is N * M. As shown in the figure:
Bob and Alice with their own definition of the coordinate system respectively, went to the coordinate point (x, y). Can they meet with each other ?
Note: Bob and Alice before reaching its destination, can not see each other because of some factors (such as buildings, time poor).
Input
There are multiple test cases. Please process till EOF. Each test case only contains four integers : N, M and x, y. The Square size is N * M, and meet in coordinate point (x, y). ( 0
Output
If they can meet with each other, please output "YES". Otherwise, please output "NO".
Sample Input
10 10 5 510 10 6 6
Sample Output
YESNO
Source
BestCoder Round #11 (Div. 2)
Recommend
heyang | We have carefully selected several similar problems for you: 5057 5052 5051 5050 5049
代码:
#include#include #include #include#include
hdu 5055 Bob and math problem
题意:
就是给出n个数字,然后要你找到一个满足如下条件的数。
(1)这个数是奇数。
(2)这个数是是最大的数。
(3)还有一个被cha的点是所有的数字都要用到。我就是0 0 1 被cha了。。我还故意特判这种情况,都是题目没有读懂啊。。
思路:
贪心的做法,首先看所有的位是否存在基数,如果基数都没有,那么肯定是不存在这种数的,其次如果有,那么就将最小的基数找出来做各位,然后将所有的位进行排序,然后从低位向高位赋值,那么就得到这个树了,最后判断一下,如果首位为0,那么这个数就是不存在的,因为要求输出所有的位。。
题目:
Bob and math problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 643 Accepted Submission(s): 245
Problem Description
Recently, Bob has been thinking about a math problem.
There are N Digits, each digit is between 0 and 9. You need to use this N Digits to constitute an Integer.
This Integer needs to satisfy the following conditions:
Example:
There are three Digits: 0, 1, 3. It can constitute six number of Integers. Only "301", "103" is legal, while "130", "310", "013", "031" is illegal. The biggest one of odd Integer is "301".
Input
There are multiple test cases. Please process till EOF.
Each case starts with a line containing an integer N ( 1 The second line contains N Digits _1, a_2, a_3, \cdots, a_n. ( 0 \leqwhich indicate the digit $a a_i \leq 9)$.
Output
The output of each test case of a line. If you can constitute an Integer which is satisfied above conditions, please output the biggest one. Otherwise, output "-1" instead.
Sample Input
30 1 335 4 232 4 6
Sample Output
301425-1
Source
BestCoder Round #11 (Div. 2)
Recommend
heyang | We have carefully selected several similar problems for you: 5057 5052 5051 5050 5049
代码:
#include#include #include #include#include