[BOJ 1008] A/B

업데이트:

문제

  • BOJ 1008
  • 문제의 저작권은 Baekjoon Online Judge에 있습니다.

접근방식

float형의 상대오차는 10^-7, double형의 상대오차는 10^-15정도이다. 따라서 double을 써줘야 틀리지 않는다.

코드

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		double a = Integer.parseInt(st.nextToken());
		double b = Integer.parseInt(st.nextToken());
		System.out.println(a/b);
	}
}

카테고리:

업데이트: