Skip to content

Commit 399e629

Browse files
committed
CT_85
1 parent 1761d90 commit 399e629

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package B2;
2+
3+
import java.util.Scanner;
4+
5+
public class Boj_7770_아즈텍피라미드 {
6+
public static void main(String[] args) {
7+
Scanner sc = new Scanner(System.in);
8+
long n = sc.nextLong();
9+
10+
long sum = 0;
11+
int h = 0;
12+
13+
for (int i = 1; ; i++) {
14+
long currentLayerBlocks = (long) i * i + (long) (i - 1) * (i - 1);
15+
sum += currentLayerBlocks;
16+
17+
if (sum > n) {
18+
break;
19+
}
20+
h++;
21+
}
22+
23+
System.out.print(h);
24+
}
25+
}

0 commit comments

Comments
 (0)