Cas001 level
获赞
220
粉丝
2
关注
0
看过 TA
5
西北工业大学
2019
算法工程师
IP属地:陕西
暂未填写个人简介
私信
关注
第一题有AC的大佬吗?能否说一下思路
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 点赞 评论 收藏
分享
关注他的用户也关注了:
牛客网
牛客企业服务