Skip to content

Commit ec898b2

Browse files
committed
Added 492A - Vanya and Cubes.cpp
1 parent ca84338 commit ec898b2

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

492A - Vanya and Cubes.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// ॐ नमः शिवाय
2+
#include<bits/stdc++.h>
3+
using namespace std;
4+
#define ll long long
5+
6+
// Code Written By: Vikash Patel
7+
// Codeforces Profile: https://codeforces.com/profile/vikashpatel
8+
9+
int main()
10+
{
11+
int cubes;
12+
cin>>cubes;
13+
int sum=0,tsum=0;
14+
int i;
15+
for(i=1;i<=cubes;i++)
16+
{
17+
sum += i;
18+
tsum += sum;
19+
if(tsum>cubes)
20+
{
21+
i--;
22+
break;
23+
}
24+
if(tsum==cubes)
25+
{
26+
break;
27+
}
28+
}
29+
cout<<i<<endl;
30+
return 0;
31+
}

0 commit comments

Comments
 (0)