Skip to content

Instantly share code, notes, and snippets.

@moosongsong
Created July 13, 2021 07:02
Show Gist options
  • Save moosongsong/5bacd1dba3457363ecf36e040173cc4a to your computer and use it in GitHub Desktop.
Save moosongsong/5bacd1dba3457363ecf36e040173cc4a to your computer and use it in GitHub Desktop.
백준 2292
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int start = 0;
int count = 1;
if (n != 1)
while (start + 1 < n) {
start += 6 * count;
count++;
}
System.out.println(count);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment