๐Ÿ”ฅBaekjoon start๐Ÿ”ฅ

arielยท2021๋…„ 11์›” 15์ผ
0

Baekjoon

๋ชฉ๋ก ๋ณด๊ธฐ
9/14
post-thumbnail

2021-11-16

โœ์ช ์™€ ํ•จ๊ป˜ ํ•˜๋ฃจ์— 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);
	}
	}

0๊ฐœ์˜ ๋Œ“๊ธ€