Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我知道此题够水,但不明白为何wa~

Posted by lichaochao321 at 2008-12-12 20:08:04
#include<iostream>
using namespace std;
int main()
{   
 int a[22];
 int b[21]={0};
 int c[21];
    int i=0;
 while (cin>>a[i])
 {
  if(a[i]==0)break;
  i++;
 }
 int d=i,e=i;
 for (;d>=0;d--)
 {
  c[d]=a[d];
 }
 for (;i>=0;i--)
    {
  for (int j=1;;j++)
  {
   a[i]-=j;
   b[i]+=j*j;
   
   if(a[i]<j)
   {
    b[i]+=a[i]*(j+1);
    break;
   }
  }
 }
    for (int k=0;k<e;k++)
    {
  cout<<c[k]<<" "<<b[k]<<endl;
  
 }
 
 return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator