회원가입
로그인
Toggle navigation
문제
문제
전체 문제
문제 출처
단계별로 풀어보기
알고리즘 분류
추가된 문제
문제 순위
문제
푼 사람이 한 명인 문제
아무도 못 푼 문제
최근 제출된 문제
최근 풀린 문제
랜덤
출처
ICPC
Olympiad
한국정보올림피아드
한국정보올림피아드시․도지역본선
전국 대학생 프로그래밍 대회 동아리 연합
대학교 대회
카카오 코드 페스티벌
Coder's High
ICPC
Regionals
World Finals
Korea Regional
Africa and the Middle East Regionals
Europe Regionals
Latin America Regionals
North America Regionals
South Pacific Regionals
문제집
대회
채점 현황
랭킹
게시판
그룹
더 보기
재채점 기록
블로그
강의
실험실
도움말
BOJ Stack
BOJ Book
전체
공지
자유
질문
오타/오역/요청
게시판 공지
홍보
업데이트
solved.ac
글쓰기
질문 도움말
자주묻는 질문
자바인데 왜 에러나는지 모르겟습니다
10825번 - 국영수
gurwns1021
7년 전
0
이클립스로 돌려보면 되게 잘나오고 시간도 1초 이상 안되는거 같은데
런타임에러가 계속 뜨네요,,, 해결좀 해주세요
import java.io.File; import java.io.FileNotFoundException; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String name; int kor, eng, math; Student student[] = new Student[12]; for(int i=0; i<12 ; i++) { name = sc.next(); kor = sc.nextInt(); eng = sc.nextInt(); math = sc.nextInt(); student[i] = new Student(name, kor, eng, math); } Arrays.sort(student); for (int i = 0; i < student.length; i++) { System.out.println(student[i].getname()); } } } class Student implements Comparable<Student>{ String name; int kor; int eng; int math; Student(String name, int kor, int eng, int math) { this.name = name; this.kor = kor; this.eng = eng; this.math = math; } public String getname() { return this.name; } public int getkor() { return this.kor; } public int geteng() { return this.eng; } public int getmath() { return this.math; } @Override public int compareTo(Student that) { if(this.kor<that.kor){ return 1; } else if(this.kor==that.kor){ if(this.eng>that.eng){ return 1; } else if(this.eng==that.eng){ if(this.math<that.math){ return 1; } else if(this.math==that.math){ if(this.name.compareTo(that.name)>0){ return 1; } } } } return -1; } }
댓글을 작성하려면
로그인
해야 합니다.
gurwns1021 7년 전
이클립스로 돌려보면 되게 잘나오고 시간도 1초 이상 안되는거 같은데
런타임에러가 계속 뜨네요,,, 해결좀 해주세요