회원가입
로그인
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
문제집
대회
1
채점 현황
랭킹
게시판
그룹
더 보기
재채점 기록
블로그
강의
실험실
도움말
BOJ Stack
BOJ Book
전체
공지
자유
질문
오타/오역/요청
게시판 공지
홍보
업데이트
solved.ac
글쓰기
질문 도움말
자주묻는 질문
왜 런타임 오류뜨죠???ㅠㅠ (코드포함)
1002번 - 터렛
ttobogims
8년 전
0
왜 런타임 에러 뜨는지 모르겠네요 ㅠㅠ
도와주세요...
그리고 런타임 오류는 제한시간 넘어서 그런건가요???
import java.util.Scanner; class Turret{ private int x1,y1,r1,x2,y2,r2; public Turret(){ Scanner input=new Scanner(System.in); x1=input.nextInt(); y1=input.nextInt(); r1=input.nextInt(); x2=input.nextInt(); y2=input.nextInt(); r2=input.nextInt(); } public void cal(){ if((x1==x2)&&(y1==y2)){ if(r1==r2) System.out.println(-1); else System.out.println(0); } else if(Math.abs(r1+r2)==Math.sqrt((Math.abs(x1-x2)*Math.abs(x1-x2))+(Math.abs(y1-y2)*Math.abs(y1-y2)))) System.out.println(1); else if(Math.abs(r1+r2)>Math.sqrt((Math.abs(x1-x2)*Math.abs(x1-x2))+(Math.abs(y1-y2)*Math.abs(y1-y2)))) System.out.println(2); else if(Math.abs(r1+r2)<Math.sqrt((Math.abs(x1-x2)*Math.abs(x1-x2))+(Math.abs(y1-y2)*Math.abs(y1-y2)))) System.out.println(0); } } public class q1002 { public static void main(String[] args) { int N; Scanner input=new Scanner(System.in); N=input.nextInt(); Turret[] ob=new Turret[N]; for(int i=0;i<N;i++){ ob[i]=new Turret(); } for(int i=0;i<N;i++){ ob[i].cal(); } } }
댓글을 작성하려면
로그인
해야 합니다.
ttobogims 8년 전
왜 런타임 에러 뜨는지 모르겠네요 ㅠㅠ
도와주세요...
그리고 런타임 오류는 제한시간 넘어서 그런건가요???