No.2027:No Brainer

No Brainer
Time Limit:1000MS  Memory Limit:30000K
Total Submit:3797 Accepted:2753

Description
Zombies love to eat brains. Yum.

Input
The first line contains a single integer n indicating the number of data sets.

The following n lines each represent a data set. Each data set will be formatted according to the following description:

A single data set consists of a line "X Y", where X is the number of brains the zombie eats and Y is the number of brains the zombie requires to stay alive.

Output
For each data set, there will be exactly one line of output. This line will be "MMM BRAINS" if the number of brains the zombie eats is greater than or equal to the number of brains the zombie requires to stay alive. Otherwise, the line will be "NO BRAINS".

Sample Input

3
4 5
3 3
4 3

 

Sample Output

NO BRAINS
MMM BRAINS
MMM BRAINS
Java实现代码:
/*
 * Main.java
 *
 * Created on 2006年9月14日, 下午9:14
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 
*/


/**
 *
 * 
@author jailu
 
*/

import java.util.*;
public class Main {

    
public static void main(String[] args) {
         Scanner cin 
= new Scanner(System.in);
         
int intCount = Integer.parseInt(cin.next());
         
int [] intInputs;

         intInputs 
= new int[intCount * 2];
         
         
for (int i = 0;i < intCount * 2; i ++)
         
{
             intInputs[i] 
= cin.nextInt();
         }

         
         
for (int i = 0;i < intCount * 2;i +=2)
         
{
             
if (intInputs[i] >= intInputs[i + 1])
             
{
                 System.out.println(
"MMM BRAINS");
             }

             
else
             
{
                 System.out.println(
"NO BRAINS");
             }

         }

    }

}


批定结果:
Run ID User Problem Result Memory Time Language Code Length Submit Time
1586136 jailu 2027 Accepted 1352K 327MS Java 0.71K 2006-09-15 03:28:47.0

收获:知道cin.next()是以空格为分界点的。
posted @ 2006-09-15 03:34  Jailu  阅读(450)  评论(0编辑  收藏  举报