delete pics to save space
This commit is contained in:
18
history_source/信息学奥赛一本通/1.4.4.10.cpp
Normal file
18
history_source/信息学奥赛一本通/1.4.4.10.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
cin>>n;
|
||||
long long ans=0;
|
||||
int i;
|
||||
for(i=1;n-i>=0;i++)
|
||||
{
|
||||
ans+=i*i;
|
||||
n-=i;
|
||||
}
|
||||
if(n>0) ans+=n*i;
|
||||
cout<<ans<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user