Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|---|
217370 | 章罗睿 | NOIP2015 普及:第一题 金币 | C++ | Accepted | 100 | 0 MS | 272 KB | 286 | 2023-12-02 10:57:20 |
#include <bits/stdc++.h> using namespace std; int main(){ long long k,ans=0; cin >> k; int g=k; for(int i=1;i<=g;i++){ for(int j=1;j<=i;j++){ ans=ans+i; k--; if(k==0)break; }if(k==0)break; }cout << ans; return 0; }