java小测试-A+B>C

import java.io.Reader;
import java.util.Scanner;


/*
 * 给定区间[-2的31次方, 2的31次方]内的3个整数A、B和C,请判断A+B是否大于C。
输入描述:
输入第1行给出正整数T(<=10),是测试用例的个数。
随后给出T组测试用例,每组占一行,顺序给出A、B和C。整数间以空格分隔。
输出描述:
对每组测试用例,在一行中输出“Case #X: true”如果A+B>C,否则输出“Case #X: false”,
其中X是测试用例的编号(从1开始)。
输入例子:
4


1 2 3


2 3 4


2147483647 0 2147483646


0 -2147483648 -2147483647


输出例子:
Case #1: false


Case #2: true


Case #3: true


Case #4: false
*/
public class Calc_abc {
	public static void main(String args[]){
		  int [] a = new int [100];
		  int [] b = new int [100];
		  int [] c = new int [100];
		  String []s=new String[100];
		  Scanner x=new Scanner(System.in);
		  int n=x.nextInt();
		  for(int i=0;i<n;i++){
			Scanner x1=new Scanner(System.in);
			s[1] =x1.next();
			s[2] =x1.next();
			s[3] =x1.next();
			a[i]= Integer.parseInt(s[1]);
			b[i]= Integer.parseInt(s[2]);
			c[i]= Integer.parseInt(s[3]);
		  }
		      for(int i=0;i<n;i++){
		    	  if((a[i]+b[i]>c[i]))
			  System.out.println("Case  #"+(i+1)+": "+true);
		    	  else
		      System.out.println("Case  #"+(i+1)+": "+false);
			  }
		
	}
}



很无赖 明明本地测试就是可以的 但是提交题目就不行了   尴尬!!!!

posted @ 2016-12-14 22:02  孙中明  阅读(114)  评论(0编辑  收藏  举报