2018-08-22 21:12
西北工业大学 算法工程师 liyangokay:package ali; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num=sc.nextInt(); double p=sc.nextDouble(); double sum1; double sum2; if(num>=3){ if(0<num*p&&num*p<50){ sum1=num*p*0.7+10; sum2=num*p-2*num*p/10+6; if(sum1>sum2){ System.out.println(2); }else if(sum1==sum2){ System.out.println(0); }else{ System.out.println(1); } }else if(num*p>=50&&num*p<99){ sum1=num*p*0.7; sum2=num*p-2*num*p/10+6; if(sum1>sum2){ System.out.println(2); }else if(sum1==sum2){ System.out.println(0); }else{ System.out.println(1); } }else if(num*p>=99){ sum1=num*p*0.7; sum2=num*p-2*num*p/10; if(sum1>sum2){ System.out.println(2); }else if(sum1==sum2){ System.out.println(0); }else{ System.out.println(1); } } }else{ if(0<num*p&&num*p<50){ sum1=num*p+10; sum2=num*p-2*num*p/10+6; if(sum1>sum2){ System.out.println(2); }else if(sum1==sum2){ System.out.println(0); }else{ System.out.println(1); } }else if(num*p>=50&&num*p<99){ sum1=num*p; sum2=num*p-2*num*p/10+6; if(sum1>sum2){ System.out.println(2); }else if(sum1==sum2){ System.out.println(0); }else{ System.out.println(1); } }else if(num*p>=99){ sum1=num*p; sum2=num*p-2*num*p/10; if(sum1>sum2){ System.out.println(2); }else if(sum1==sum2){ System.out.println(0); }else{ System.out.println(1); } } } } }
投递华为等公司10个岗位 >
0 点赞 评论 收藏
分享
2018-08-03 11:36
西北工业大学 算法工程师 0 点赞 评论 收藏
分享
关注他的用户也关注了: