一、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.

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.

二、题目分析

        水题,只是做日常工作记录。

三、Java代码

import java.util.Scanner;

 public class Main {

     public static void main(String[] args) {
Scanner cin=new Scanner(System.in);
int n;
int [][] arr;
while((n=cin.nextInt())!=0){
int sum=0;
int day=0;
arr=new int [n][2];
for(int i=0;i<n;i++){
for(int j=0;j<2;j++){
arr[i][j]=cin.nextInt();
}
if((arr[i][0]+arr[i][1])>sum){
sum=(arr[i][0]+arr[i][1]);
day=i+1;
}
}
if(sum > 8){
System.out.println(day);
}else{
System.out.println(0);
}
}
}
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

Poj2656(水题)的更多相关文章

  1. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  2. ACM :漫漫上学路 -DP -水题

    CSU 1772 漫漫上学路 Time Limit: 1000MS   Memory Limit: 131072KB   64bit IO Format: %lld & %llu Submit ...

  3. ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)

    1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 154  Solved: 112[ ...

  4. [poj2247] Humble Numbers (DP水题)

    DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...

  5. gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,

    1195: 相信我这是水题 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 821  Solved: 219 Description GDUT中有个风云人 ...

  6. BZOJ 1303 CQOI2009 中位数图 水题

    1303: [CQOI2009]中位数图 Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 2340  Solved: 1464[Submit][Statu ...

  7. 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛 B - 大还是小? 字符串水题

    B - 大还是小? Time Limit:5000MS     Memory Limit:65535KB     64bit IO Format: Description 输入两个实数,判断第一个数大 ...

  8. ACM水题

    ACM小白...非常费劲儿的学习中,我觉得目前我能做出来的都可以划分在水题的范围中...不断做,不断总结,随时更新 POJ: 1004 Financial Management 求平均值 杭电OJ: ...

  9. CF451C Predict Outcome of the Game 水题

    Codeforces Round #258 (Div. 2) Predict Outcome of the Game C. Predict Outcome of the Game time limit ...

随机推荐

  1. mongo explain分析详解

    1 为什么要执行explain,什么时候执行 explain的目的是将mongo的黑盒操作白盒化. 比如查询很慢的时候想知道原因. 2 explain的三种模式 2.1 queryPlanner 不会 ...

  2. php输出缓冲区

    ob_start(); echo 'aaa'; $string = ob_get_contents(); file_put_contents('a.html', $string); ob_flush( ...

  3. 在C语言中使用syslog打印日志到日志文件

    参见 <unix 环境高级编程>第13 章 精灵进程 Syslog为每个事件赋予几个不同的优先级: LOG_EMERG——紧急情况 LOG_ALERT——应该被立即改正的问题,如系统数据库 ...

  4. 11.2.3 Redis的启动停止

    11.2.3  Redis的启动停止 Redis安装配置完成后,启动过程非常简单,执行命令/usr/local/redis/bin/redis-server /usr/local/redis/etc/ ...

  5. 3.30课·········Marquee标签

    页面的自动滚动效果,可由javascript来实现, 但是有一个html标签 - <marquee></marquee>可以实现多种滚动效果,无需js控制. 使用marquee ...

  6. 每天一个Linux命令(22)find命令_命令详解

        find命令的一些常用参数的常用实例和用时的注意事项.     实例:     (1)-name参数: 1)[sunjimeng@localhost home]$ find ~ -name & ...

  7. WPF之基础概念

    一:App环境承载 我们都知道Console和WinForm程序的入口都是Main函数,WPF同样也不例外,好了,我们就新建一个WPF应用程序,VS会给我们自动生成一个MainWindow.xaml和 ...

  8. STM32 MCO时钟输出配置实验

    STM32的PA.8引脚具有复用功能——时钟输出(MCO), 该功能能将STM32内部的时钟通过PA.8输出. 操作流程: 1).设置PA.8为复用AF模式. RCC_AHB1PeriphClockC ...

  9. 同步异步阻塞非阻塞Reactor模式和Proactor模式 (目前JAVA的NIO就属于同步非阻塞IO)

    在高性能的I/O设计中,有两个比较著名的模式Reactor和Proactor模式,其中Reactor模式用于同步I/O,而Proactor运用于异步I/O操作. 在比较这两个模式之前,我们首先的搞明白 ...

  10. mac下搭建前端自动化工程

    好多年没有接触前端,发现前端行业发生了巨大的变化,很多新鲜术语,比如node.git.grunt.less.sass.预编译.自动化.模块化等等,看得让人晕头转向,不要担心,我会把这之前之后学习成果都 ...