Algorithm/BOJ 기초
[백준] 소인수분해 11653 Python C++
hackyu
2019. 10. 2. 07:22
Python
|
1
2
3
4
5
6
7
8
9
|
N = int(input())
summ = 0
i = 0
while summ <= N:
i+=1
summ+=i
print(i-1)
|
cs |
C++
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#include <iostream>
using namespace std;
int main() {
int i = 0;
long sum = 0;
long N = 0;
scanf("%ld", &N);
while (sum <= N){
i += 1;
sum += i;
}
printf("%d\n", i - 1);
return 0;
}
|
cs |