POJ 2656 Unhappy Jinjin
来源:互联网 发布:淘宝分销商赚钱吗 编辑:程序博客网 时间:2024/05/21 17:19
Unhappy Jinjin
Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 11472 Accepted: 8396
Description
Jinjin is a junior school student. Besides the classes in school, Jinjin's mother also arranges some supplementary classes for her. However, if Jinjin studies for more than eight hours a day, she will be unhappy on that day. On any day she gets unhappy, the more time she studies, the unhappier she will be. Now we got Jinjin's class schedule for the next several days and your task is to find out whether she will be unhappy on these days; if she will be unhappy, on which day she will be the unhappiest.
Input
There may be several test cases. In the first line of each test case, there is an integer N (1 <= N <= 7), which represents the number of days you should analyze. Then there comes N lines, each contains two non-negative integers (each smaller than 10). The first integer represents how many hours Jinjin studies at school on the day, and the second represents how many hours she studies in the supplementary classes on the same day.
A case with N = 0 indicates the end of the input, and this case should not be processed.
A case with N = 0 indicates the end of the input, and this case should not be processed.
Output
For each test case, output a line contains a single integer. If Jinjin will always be happy, the integer should be 0; otherwise, the integer should be a positive integer K, which means that Jinjin will be the unhappiest on the K-th day. If the unhappiest day is not unique, just output the earliest one among these unhappiest days.
Sample Input
75 36 27 25 35 40 40 614 40
Sample Output
30
超级大水题:
#include <iostream>#include <cstdio>using namespace std;int main(int argc, const char * argv[]) { int n; int a,b; while(scanf("%d",&n)&&n) { int mx=0,src=0; for(int i=1;i<=n;i++) { scanf("%d %d",&a,&b); if(a+b>8&&a+b>mx) { mx=a+b;//将最不开心的那一天的学习时间存储下来,与接下来的输入进行判断 src=i;//存储最不开心的是哪一天 } } cout<<src<<endl; } return 0;}
0 0
- poj 2656 Unhappy Jinjin
- poj 2656 Unhappy Jinjin
- POJ 2656 Unhappy Jinjin
- poj 2656 Unhappy Jinjin
- POJ 2656 Unhappy Jinjin
- POJ 2656 Unhappy Jinjin
- POJ 2656 Unhappy Jinjin G++
- (Relax ST1.14)POJ 2656 Unhappy Jinjin
- POJ 2656 Unhappy Jinjin(水题)
- POJ 2656 Unhappy Jinjin(水~)
- 百练 2656 Unhappy Jinjin
- 【POJ2656】:Unhappy Jinjin
- poj2656 Unhappy Jinjin
- POJ 2656 Unhappy Jinjin(我的水题之路——不开心的学习日)
- Santander unhappy customer
- How to express that you are unhappy.
- USTC 1281 Unhappy dots STL map
- USTCOJ 1281 Unhappy dots 快排模板
- 基于消失点检测的道路检测(附源码)
- HTML-css 简单网页小制作(图片、文字)---Day2
- ByteBuffer常用方法详解
- 资料搬运 理解LINUX IO
- 线性回归
- POJ 2656 Unhappy Jinjin
- Qt Property System
- asyncio 官方文档
- Linux下的硬链接和软链接
- OpenGL 的空间变换(下):空间变换
- (最小生成树)ZOJ 1406 Jungle Roads
- 如何修改jar包中的class文件
- poj-3083-Children of the Candy Corn-DFS+BFS
- 【hibernate】多对一,一对多关系