-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ2292.java
More file actions
27 lines (24 loc) Β· 1.08 KB
/
Q2292.java
File metadata and controls
27 lines (24 loc) Β· 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* Date: 2018. 10. 9.
* Author: inhyuck | https://github.com/inhyuck
* Solution URL: https://github.com/inhyuck/algorithm
* Title: λ²μ§
* description: μμ κ·Έλ¦Όκ³Ό κ°μ΄ μ‘κ°νμΌλ‘ μ΄λ£¨μ΄μ§ λ²μ§μ΄ μλ€.
* κ·Έλ¦Όμμ 보λ λ°μ κ°μ΄ μ€μμ λ°© 1λΆν° μμν΄μ μ΄μνλ λ°©μ λμκ°λ©΄μ 1μ© μ¦κ°νλ λ²νΈλ₯Ό μ£Όμλ‘ λ§€κΈΈ μ μλ€.
* μ«μ Nμ΄ μ£Όμ΄μ‘μ λ, λ²μ§μ μ€μ 1μμ Nλ² λ°©κΉμ§ μ΅μ κ°μμ λ°©μ μ§λμ κ° λ
* λͺ κ°μ λ°©μ μ§λκ°λμ§(μμκ³Ό λμ ν¬ν¨νμ¬)λ₯Ό κ³μ°νλ νλ‘κ·Έλ¨μ μμ±νμμ€.
* Problem URL: https://www.acmicpc.net/problem/2292
*/
package io.inhyuck.basic;
import java.util.Scanner;
public class Q2292 {
public static void main(String[] args) {
int n = new Scanner(System.in).nextInt();
int count = 1; //μ§λλ λ°©μ νμ
int MaxRange = 1; //λμΌν countμμμ λ°©μ μ΅λ λ²νΈ
while (MaxRange < n) {
MaxRange += 6 * count++;
}
System.out.println(count);
}
}