网易模拟第一题,0%,请各位大神指教,哪里错了

网易模拟第一题,0%,请各位大神指教,哪里错了
import java.util.Scanner; public class Main { public static void main(String[] args) {
Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] num = new int[n]; for (int i = 0; i < n; i++) {
   num[i] = in.nextInt();
}
in.close(); int out[] = new int[n]; for (int i = 0; i < n; i++) { int temp = num[i]; double sum = serach(temp - 5000);
out[i] = (int) Math.round(sum);
} for (int i = 0; i < out.length; i++) {
System.out.println(out[i]);
}
} public static double serach(int x){ double sum = 0.0; if(x<=0){
            sum = 0.0;
        }else if(x>0 && x<=3000){
            sum = x * 0.03;
        }else if(x>3000 && x<=12000){
            sum = 3000 * 0.03 + (x-3000) * 0.1;
        }else if(x>12000 && x<=25000){
            sum = 3000 * 0.03 + (12000-3000) * 0.1 + (x-12000)*0.2;
        }else if(x>25000 && x<=35000){
            sum = 3000 * 0.03 + (12000-3000) * 0.1 + (25000-12000)*0.2 + (x-25000)*0.25;
        }else if(x>35000 && x<=55000){
            sum = 3000 * 0.03 + (12000-3000) * 0.1 + (25000-12000)*0.2 + (35000-25000)*0.25 + (x-35000)*0.3;
        }else if(x>55000 && x<=80000){
            sum = 3000 * 0.03 + (12000-3000) * 0.1 + (25000-12000)*0.2 + (35000-25000)*0.25 + (80000-35000)*0.3 + (x-55000)*0.35;
        }else if(x>80000){
            sum = 3000 * 0.03 + (12000-3000) * 0.1 + (25000-12000)*0.2 + (35000-25000)*0.25 + (80000-35000)*0.3 + (80000-55000)*0.35 + (x-80000)*0.45;
        } return sum;
    }
}

#网易##笔试题目#
全部评论

相关推荐

不愿透露姓名的神秘牛友
07-02 17:28
25届每天都在焦虑找工作的事情0offer情绪一直很低落硬撑着面了一个岗位岗位有应酬的成分面试的时候hr给我出各种场景题问的问题比较犀利&nbsp;有点压力面的感觉感觉有点回答不上来本来就压抑的情绪瞬间爆发了呢一瞬间特别想哭觉得自己特别没用没绷住掉眼泪了事后想想觉得自己挺有病的&nbsp;真的破大防了
喜欢唱跳rap小刺猬...:我觉得没关系吧,之前有一次面试leader给我压力面,我顶住了压力,结果入职的时候发现组里氛围很差,果断跑路。其实从面试就能大概看出组的情况,面试体验好的组倒是不一定好,但是面试体验不好的组。。。就很难说
点赞 评论 收藏
分享
05-23 19:02
吉林大学 Java
点赞 评论 收藏
分享
星辰再现:裁员给校招生腾地方
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务