Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
7800 鲁家菱 金币 C++ 通过 0 MS 240 KB 314 2023-02-07 18:28:52

Tests(1/1):


#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int s=1,w=1;; long long sum=0; for(int i=1;i<=n;i++){ while(s--){ if(i<=n){ sum+=w; i++; } else{ cout<<sum; return 0; } } w++; s=w; i--; } cout<<sum; return 0; }


测评信息: