T1.金币

题目链接

 1 #include<cstdio>
 2 #include<algorithm>
 3 #include<cstring>
 4 using namespace std;
 5 int k;
 6 long long ans;
 7 int main()
 8 {
 9     scanf("%d",&k);
10     int cnt=1;
11     while(k)
12     {
13         for(int i=1;i<=cnt;i++)
14         {
15             if(k==0)break;
16             ans+=cnt;k--;
17         }
18         cnt++;
19         if(k==0)break;
20     }
21     printf("%lld",ans);
22     return 0;
23 }
View Code

相关文章:

  • 2021-11-13
  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
  • 2019-08-17
  • 2021-09-19
  • 2021-06-28
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-31
  • 2022-12-23
  • 2021-04-24
相关资源
相似解决方案