Codeforces Round #357 (Div. 2) A. A Good Contest 水题
A. A Good Contest
题目连接:
http://www.codeforces.com/contest/681/problem/A
Description
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: i-th} of them consists of a participant handle namei and two integers beforei and afteri ( - 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.
Sample Input
3
Burunduk1 2526 2537
BudAlNik 2084 2214
subscriber 2833 2749
Sample Output
YES
Hint
题意
有n个人,给你这个人的名字,这个人比赛前的分数,比赛后的分数
如果存在一个人之前的分数>=2400,且还涨分了
那就输出yes
题解:
按照题意模拟一下就好了
代码
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
scanf("%d",&n);
string s1;
int a,b;
int flag = 0;
for(int i=0;i<n;i++)
{
cin>>s1>>a>>b;
if(a>=2400&&b>a)
flag = 1;
}
if(flag==1)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}