Codeforces Round #357 (Div. 2)

Codeforces Round #357 (Div. 2)

A. A Good Contest
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Codeforces user' handle color depends on his rating — it is red if his rating is greater or equal to 2400; it is orange if his rating is less than 2400 but greater or equal to 2200, etc. Each time participant takes part in a rated contest, his rating is changed depending on his performance.

Anton wants the color of his handle to become red. He considers his performance in the rated contest to be good if he outscored some participant, whose handle was colored red before the contest and his rating has increased after it.

Anton has written a program that analyses contest results and determines whether he performed good or not. Are you able to do the same?

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of participants Anton has outscored in this contest .

The next n lines describe participants results: the i-th of them consists of a participant handle namei and two integers beforei andafteri ( - 4000 ≤ beforei, afteri ≤ 4000) — participant's rating before and after the contest, respectively. Each handle is a non-empty string, consisting of no more than 10 characters, which might be lowercase and uppercase English letters, digits, characters «_» and «-» characters.

It is guaranteed that all handles are distinct.

Output

Print «YES» (quotes for clarity), if Anton has performed good in the contest and «NO» (quotes for clarity) otherwise.

Examples
input
3
Burunduk1 2526 2537
BudAlNik 2084 2214
subscriber 2833 2749
output
YES
input
3
Applejack 2400 2400
Fluttershy 2390 2431
Pinkie_Pie -2500 -2450
output
NO
Note

In the first sample, Anton has outscored user with handle Burunduk1, whose handle was colored red before the contest and his rating has increased after the contest.

In the second sample, Applejack's rating has not increased after the contest, while both Fluttershy's and Pinkie_Pie's handles were not colored red before the contest.


大于2400(红名)且排名长了输出yes

#include 
#include 

using namespace std;

int main()
{
    int n;
    while(cin>>n){
        int ans=0;
        string str;
        long long a,b;
        while(n--){
            cin>>str>>a>>b;
            if(a>=2400&&b>a)
            ans++;
        }
        if(ans)
            cout<<"YES"<


B. Economy Game
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Kolya is developing an economy simulator game. His most favourite part of the development process is in-game testing. Once he was entertained by the testing so much, that he found out his game-coin score become equal to 0.

Kolya remembers that at the beginning of the game his game-coin score was equal to n and that he have bought only some houses (for1 234 567 game-coins each), cars (for 123 456 game-coins each) and computers (for 1 234 game-coins each).

Kolya is now interested, whether he could have spent all of his initial n game-coins buying only houses, cars and computers or there is a bug in the game. Formally, is there a triple of non-negative integers ab and c such thata × 1 234 567 + b × 123 456 + c × 1 234 = n?

Please help Kolya answer this question.

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 109) — Kolya's initial game-coin score.

Output

Print "YES" (without quotes) if it's possible that Kolya spent all of his initial n coins buying only houses, cars and computers. Otherwise print "NO" (without quotes).

Examples
input
1359257
output
YES
input
17851817
output
NO
Note

In the first sample, one of the possible solutions is to buy one house, one car and one computer, spending1 234 567 + 123 456 + 1234 = 1 359 257 game-coins in total.


模拟(韩信点兵)

#include 

using namespace std;

void solve(int n){
    for(int i=0;1;i++){
            if(i*1234567>n) break;
            else{
                for(int j=0;1;j++){
                    if(i*1234567+j*123456>n) break;
                    else{
                        if((n-(i*1234567+j*123456))%1234==0){
                            cout<<"YES"<>n){
        solve(n);
    }
}



你可能感兴趣的:(Codeforces Round #357 (Div. 2))