首页 > 其他分享 >[2015年NOIP普及组] 金币

[2015年NOIP普及组] 金币

时间:2022-08-13 08:31:17浏览次数:51  
标签:std NOIP ++ 模拟出 bj 金币 int 2015

模拟出每天骑士获得的金币,加起来

#include<bits/stdc++.h>
using namespace std;
int main(){
int n,i,j=0,s=0,bj=1;
cin>>n;
for(i=1;i<=n;i++){
j++;
s=s+bj;
if(j==bj){
bj++;
j=0;
}
}
cout<<s;
}

标签:std,NOIP,++,模拟出,bj,金币,int,2015
From: https://www.cnblogs.com/wangjunlong9948/p/16581943.html

相关文章