java有毒, 怎么一直零分, 没道理啊!!!大牛帮忙看看


import java.util.ArrayList;
import java.util.Scanner;

public class Main {
  
  public static void main(String[] args) {
    Scanner cin = new Scanner(System.in);
    int n = cin.nextInt(), sumReward = 0, maxLoc = 0;
    ArrayList<Student> info = new ArrayList<Student>();
    
    for (int i = 0; i < n; ++i) {
      info.add(new Student(cin.next(), cin.nextInt(), 
          cin.nextInt(), cin.next(), cin.next(), cin.nextInt()));
      sumReward += info.get(i).reward;
      if (info.get(i).reward > info.get(maxLoc).reward) { maxLoc = i; }
    }
    System.out.println(info.get(maxLoc).name);
    System.out.println(info.get(maxLoc).reward);
    System.out.println(sumReward);
  }
  
}

class Student {
  String name;
  int finalAverageScore;
  int classCommentScore;
  String isClassLeader;
  String isWestStudent;
  int paperQuentity;
  int reward;
  Student(String n, int fas, int ccs, String icl, String iws, int pq) {
    name = n;
    finalAverageScore = fas;
    classCommentScore = ccs;
    isClassLeader = icl;
    isWestStudent = iws;
    paperQuentity = pq;
    reward = GetReward(0);
    
  }
  
  int GetReward(int arg) {
    if (finalAverageScore > 80 && paperQuentity >= 1) {
      arg += 8000;
    }
    if (finalAverageScore > 85 && classCommentScore > 80) {
      arg += 4000;
    }
    if (finalAverageScore > 90) {
      arg += 2000;
    }
    if (finalAverageScore > 85 && isWestStudent.equals("Y")) {
      arg += 1000;
    }
    if (classCommentScore > 80 && isClassLeader.equals("Y")) {
      arg += 850;
    }
    return arg;
  }
  
}

2 条评论

  • 1

信息

ID
1001
难度
5
分类
模拟 点击显示
标签
递交数
39063
已通过
12711
通过率
33%
被复制
121
上传者