PS/백준
백준 - 알고리즘 수업 - 점근적 표기 1 ( Java )
종안이
2023. 11. 25. 18:44
알고리즘 코드를 봤을때 대략적인 수행 시간을 유추할 수 있게 된 것 같다.
package com.company.baekjoon.silver;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class 알고리즘점근적표기법1 {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
String s = bf.readLine();
String[] split = s.split(" ");
int a1 = Integer.parseInt(split[0]);
int a0 = Integer.parseInt(split[1]);
int c = Integer.parseInt(bf.readLine());
int n = Integer.parseInt(bf.readLine());
int fn = a1 * n + a0;
int gn = c * n;
if (fn <= gn && c >= a1) {
System.out.println(1);
} else {
System.out.println(0);
}
}
}