1 solutions
-
0
C :
#include <stdio.h> int main() { int n,t=0; int num = 1; scanf("%d",&n); while(n) { if(n<num) num = 1; n -= num; ++num; ++t; } printf("%d\n", t); return 0; }C++ :
#include<iostream> using namespace std; int main() { int n,k,time=0; cin>>n; while(n) { k=1; n-=k; time++; k++; while(k<=n) { n-=k; time++; k++; } } cout<<time<<endl; return 0; }
- 1
Information
- ID
- 16842
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By