We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ca84338 commit ec898b2Copy full SHA for ec898b2
492A - Vanya and Cubes.cpp
@@ -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
27
28
29
+ cout<<i<<endl;
30
+ return 0;
31
+}
0 commit comments