Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## runtime error，java程序贴出来了，请帮！！

Posted by UnleashYourPotential at 2010-12-07 14:25:57 on Problem 1528
```import java.util.Scanner;

public class Main1528 { //runtime error

public static void main(String[] args) {

Scanner in = new Scanner(System.in);
String[] line = in.nextLine().split("\\s");
int i = 0;
int current = 0;
StringBuffer buffer = new StringBuffer();
buffer.append("PERFECTION OUTPUT\n");
for (; i < line.length - 1; i++) {
current = Integer.parseInt(line[i]);

for (int j = 0; j < 6 - line[i].length(); j++) {
buffer.append(" ");
}
String result = compute(current);
buffer.append(current + "  " + result + "\n");

}
buffer.append("END OF OUTPUT\n");
System.out.print(buffer);
}

private static String compute(int current) {

int i = 2;
int sum = 1;

if (current % 2 != 0) {
for (i = 3; i <= current/2; i += 2) {
if (current % i == 0)
sum += i;
}
} else{
for (i = 2; i <= current/2; i++) {
if (current % i == 0)
sum += i;
}
}
if (current==1) sum = 0;

if (sum < current)
return  "DEFICIENT";
else if (sum > current)
return "ABUNDANT";
else
return "PERFECT";
}
}```

Followed by: