A. A Good Contest
2016-06-16 18:27
302 查看
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 integersbeforei 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.
Examples
input
output
input
output
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
andPinkie_Pie's handles were not colored red before the contest.
解题说明:此题是一道水题,判断数字是否大于2400,以及前后数字相差。
#include<cstdio>
#include <cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<vector>
#include <map>
using namespace std;
int main()
{
char str[10];
int n,rb,ra,flag=0;
scanf("%d",&n);
while(n--)
{
scanf("%s %d %d",str,&rb,&ra);
if(rb>=2400 && ra>rb)
{
flag=1;
}
}
if(flag==1)
{
printf("YES\n");
}
else
{
printf("NO\n");
}
return 0;
}
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 integersbeforei 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.
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
andPinkie_Pie's handles were not colored red before the contest.
解题说明:此题是一道水题,判断数字是否大于2400,以及前后数字相差。
#include<cstdio>
#include <cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<vector>
#include <map>
using namespace std;
int main()
{
char str[10];
int n,rb,ra,flag=0;
scanf("%d",&n);
while(n--)
{
scanf("%s %d %d",str,&rb,&ra);
if(rb>=2400 && ra>rb)
{
flag=1;
}
}
if(flag==1)
{
printf("YES\n");
}
else
{
printf("NO\n");
}
return 0;
}
相关文章推荐
- golang学习之interface与其它类型转换
- django正续或者倒序查库
- mongo中删除filed不存在的document
- algorithm库介绍之---- stable_sort()方法 与 sort()方法 .
- Golang中的interface
- 如何在Go中使用Protobuf
- mongo中插入的数据含有_class信息
- (EM算法)The EM Algorithm
- mongoose 相关操作
- django orm 操作
- Diy Win7 OEMlogo
- django view call model methods
- golang学习之奇葩的time format
- mongoose 模式使用
- Django -model的字段类型清单
- Django快速搭建Blog
- django URL模式浅析
- golang map to struct
- go性能调优2
- go性能调优1