23 条题解
-
8limingjie LV 7 @ 2022-1-8 11:18:40
#include <stdio.h> #include <iostream> using namespace std; int main() { int n; cin >> n; int sum = 0; int num =1,day = 1; for (int i = 1 ; i <= n ; i++) { sum += num; day -= 1; if(day ==0) { num++; day = num; } } cout << sum << endl; }
-
32022-10-29 14:14:22@
#include <stdio.h> #include <iostream> #include <math.h> using namespace std; int main() { int a; cin>>a; int sum=0; int num=1,day=1; for(int i=1;i<=a;i++) { sum+=num; day-=1; if(day==0) { num++; day=num; } } cout<<sum; }
-
12023-6-8 18:37:12@
#include<bits/stdc++.h> using namespace std; int a,b,c; int main(){ cin>>a; for(int i=1,j=0;i<=a;i++,j++){ if(j==c){ c++; j=0; } b+=c; } cout<<b; return 0; }
-
12023-6-6 17:51:11@
#include<bits/stdc++.h> using namespace std; int n,cnt=0,sum=1; int main(){ cin>>n; for(int i=1,j=0;i<=n;i++,j++){ if(j==sum){ sum++; j=0; } cnt+=sum; } cout<<cnt; return 0; }
-
12022-1-8 11:26:06@
#include <iostream> #include <math.h> #include <iomanip> using namespace std; #define LL Long Long const int N=1e5+10; const int INF=0x3f3f3f3f; int main() { int n; cin >> n; int sum = 0; int sum = 1 , day = 1; for (int i = 1 ; i <= n ; i++) { sum += sum; day -=1; if(day == 0) { num++; day = num; } } cout << sum << endl; }
-
12022-1-8 11:20:05@
#include <stdio.h> #include <iostream> using namespace std; int main() { int n; cin >> n; int sum = 0; int num = 1,day = 1; for(int i = 1; i <= n ; i++) { sum += num; day -= 1; if (day == 0) { num++; day = num; } } cout << sum << endl; }
-
12022-1-8 11:15:53@
#include <stdio.h> #include <iostream> #include <math.h> using namespace std; int main() { int a; cin>>a; int sum=0; int num=1,day=1; for(int i=1;i<=a;i++) { sum+=num; day-=1; if(day==0) { num++; day=num; } } cout<<sum; }
-
02024-11-22 19:05:07@
#include <bits/stdc++.h> using namespace std; int a,t=1,n,ans; int main() { cin>>a; for(int i=1;i<=a;i++){ ans+=t; n++; if(t==n){ t++; n = 0; } } cout<<ans; return 0; }
-
02024-10-13 18:59:38@
#include <stdio.h> #include <iostream> using namespace std; int main() { int n; cin >> n; int sum = 0; int num = 1,day = 1; for (int i =1; i <= n ; i++) { sum += num; day -= 1; if(day == 0) { num++; day = num; } } cout << sum << endl; }
-
02024-10-13 18:59:20@
#include <stdio.h> #include <iostream> using namespace std; int main() { int n; cin >> n; int sum = 0; int num = 1,day = 1; for (int i =1; i <= n ; i++) { sum += num; day -= 1; if(day == 0) { num++; day = num; } } cout << sum << endl; }
-
02024-1-30 15:00:57@
#include <iostream> using namespace std; int main() { int n; cin >> n; int sum = 0; int num =1,day = 1; for (int i = 1 ; i <= n ; i++) { sum += num; day -= 1; if(day ==0) { num++; day = num; } } cout << sum << endl; }
-
02024-1-16 17:24:58@
#include<stdio.h> #include<iostream> #include<math.h> using namespace std; int main() { int n; cin>>n; for(int i=1;i<=n+1;i++) { for(int j=1;j<=n2+1;j++) { if(n-i+2j||n+ij) { cout<<""; } else { cout<<" "; } } cout<<endl; } for(int i=n;i>=1;i--) { for(int j=1;j<=n2+1;j++) { if(n-i+2j||n+ij) { cout<<""; } else { cout<<" "; } } cout<<endl; } }
-
02024-1-16 17:24:43@
#include<stdio.h> #include<iostream> #include<math.h> using namespace std; int main() { int n; cin>>n; for(int i=1;i<=n+1;i++) { for(int j=1;j<=n2+1;j++) { if(n-i+2j||n+ij) { cout<<""; } else { cout<<" "; } } cout<<endl; } for(int i=n;i>=1;i--) { for(int j=1;j<=n2+1;j++) { if(n-i+2j||n+ij) { cout<<""; } else { cout<<" "; } } cout<<endl; } }
-
02023-8-27 18:16:43@
# 循环嵌套初学者看过来! #include <iostream> #include <iomanip> #include <cmath> using namespace std; long long n,day,sum; int main() { cin >> n; for(int i = 1;i <= n;i++) { for(int j = 1;j <= i;j++) { day++; sum += i; if(day == n) { cout << sum; return 0; } } } return 0; }
-
02023-3-26 20:19:22@
using namespace std; long long n,sum,day,i,j; int main() { cin>>n; for(i=1;i<=n;i++) { sum = sum+i*i; day = (1+i)*i/2; if(day>=n) { sum=sum-(day-n)*i; cout<<sum; return 0; } } }
-
02023-3-26 19:57:36@
#include<iostream>
using namespace std; int t; int main(){ int n,sum=0,day=0; cin>>n; for(int i=1;i<=n;i++){
sum=sum+i*i; day=(1+i)*i/2; if(day>=n){ sum=sum-(day-n)*i; cout<<sum; return 0; } } cout<<t; return 0;
}
-
02023-3-26 19:32:28@
#include<iostream>
using namespace std; int t; int main(){ int n,sum=0,day=0; cin>>n; for(int i=1;i<=n;i++){ for(int j=1;j<=i;j++){ sum+=i; day++; if(day==n){ cout<<sum; return 0; } }
} cout<<t; return 0;
}
-
02023-3-26 19:32:20@
#include<iostream>
using namespace std; int t; int main(){ int n,sum=0,day=0; cin>>n; for(int i=1;i<=n;i++){ for(int j=1;j<=i;j++){ sum+=i; day++; if(day==n){ cout<<sum; return 0; } }
} cout<<t; return 0;
}
-
02023-3-26 19:32:06@
#include<iostream> using namespace std; int main() { int k, coin = 0, day = 0; cin >> k; for (int i = 1;; i++) for (int j = 1; j <= i; j++) { coin += i; day++; if (day == k) { cout << coin << endl; return 0; } } return 0; }
-
02023-3-26 18:40:35@
#include <iostream> #include <stdio.h> #include <string.h> using namespace std; double n,sum,day; int main(){ cin>>n; for(int i=1;i<=n;i++){ sum=sum+1*1;; day=(i+1)*i/2; if(day==n){ cout<<sum; return 0; } } }
信息
- ID
- 919
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 5
- 标签
- 递交数
- 978
- 已通过
- 405
- 上传者