| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:绝对通俗……0msIn Reply To:绝对通俗……0ms Posted by:tankadozmy at 2010-02-08 11:41:34 > #include<iostream>
> using namespace std;
> int main()
> {
> int n,c_n,i,coin=0;
> while(cin>>n)
> {
> if(n==0) break;
> i=1; coin=0; c_n=n;
> while(1)
> {
> if(n-i<=0) {coin+=n*i; break;}
> else coin+=i*i;
> n-=i ;
> i++;
> }
> cout<<c_n<<" "<<coin<<endl;
> }
> return 0;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator