1011 A+B 和 C (15 分)

【思路】注意使用long,因为int范围的数字相加a+b有可能会溢出,超过int的最大范围。
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        int n= sc.nextInt();//输入数
        for(int i=0; i<n; i++){
            Long A = sc.nextLong();
            Long B = sc.nextLong();
            Long C = sc.nextLong();
            if(A+B > C){
                System.out.println("Case #" + (i+1)+ ": true");
            }else{
                System.out.println("Case #" + (i+1)+": false");
            }
        }
        
    }
}


全部评论

相关推荐

吴offer选手:学到了,下次面试也放张纸在电脑上,不然老是忘记要说哪几个点
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务