1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <iostream> using namespace std; int main() { int N; int i = 0; cin >> N; for (int sum = 2; sum <= N; i++) sum += 6 * i; if (N == 1) i = 1; cout << i; return 0; } | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <iostream> using namespace std; int main() { int N; int i = 0; cin >> N; for (int sum = 2; sum <= N; i++) sum += 6 * i; if (N == 1) i = 1; cout << i; return 0; } | cs |