โ์ช ์ ํจ๊ป ํ๋ฃจ์ 30๋ถ ์ด์ ์์โจ
1712
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int C = sc.nextInt();
if(C<=B) {
System.out.println("-1");
}
else {
System.out.println((A/(C-B))+1);
}
}
}
2292
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int room = 1;
int count = 1;
int number = 0;
room= sc.nextInt();
for(int i=0; i<100000000; i++) {
number += i*6;
if((number)<room) {
count++;
}
else {
break;
}
}
System.out.println(count);
}
}
2292
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int count = 1; //๊ฒน ์ (์ต์ ๋ฃจํธ)
int range = 2; //๋ฒ์(์ต์๊ฐ ๊ธฐ์ค)
if(N == 1) { //1์ผ ๊ฒฝ์ฐ ๋ฐ๋ก ์ถ๋ ฅ
System.out.print(1);
}else {
while(range<=N) { //๋ฒ์๊ฐ N๋ณด๋ค ์ปค์ง๊ธฐ ์ง์ ๊น์ง ๋ฐ๋ณต
range = range + (6 * count); //๋ค์ ๋ฒ์์ ์ต์๊ฐ์ผ๋ก ์ด๊ธฐํ
count++; //count 1์ฆ๊ฐ
}
System.out.print(count);
}
}
}
1193
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N =sc.nextInt();
int cc = 1, pcs = 0;
while(true) {
//์ง์ ๋๊ฐ์ ๋์ ํฉ + ํด๋น ๋๊ฐ์ ๊ฐ์ ์ด์ฉํ ๋ฒ์ ํ๊ฒฐ
if(N <= pcs + cc) {
if(cc % 2 == 1) { // ๋๊ฐ์ ์ ๊ฐ์๊ฐ ํ์๋ผ๋ฉด
//๋ถ๋ชจ๊ฐ ํฐ ์๋ถํฐ ์์
//๋ถ๋ชจ๋ ๋๊ฐ์ ๊ฐ์ - (N ๋ฒ์งธ - ์ง์ ๋๊ฐ์ ๊น์ง์ ๋์ ํฉ - 1)
//๋ถ์๋ X ๋ฒ์งธ - ์ง์ ๋๊ฐ์ ๊น์ง์ ๋์ ํฉ
System.out.print((cc - (N - pcs - 1))+"/"+(N - pcs));
break;
}else {//๋๊ฐ์ ์ ๊ฐ์๊ฐ ์ง์๋ผ๋ฉด
//ํ์์ผ ๋์ ์ถ๋ ฅ์ ๋ฐ๋๋ก
System.out.print((N - pcs)+"/"+(cc - (N - pcs -1)));
break;
}
}else {
pcs += cc;
cc++;
}
}
}
}
2869
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int A =sc.nextInt();
int B =sc.nextInt();
int V =sc.nextInt();
int day = (V-B)/(A-B);
//๋๋จธ์ง๊ฐ ์์ ๊ฒฝ์ฐ
if((V - B) % (A - B) != 0) {
day++;
}
System.out.println(day);
}
}