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

大家帮我看看了,我咋看我的都不错

Posted by shan_mao_mao at 2009-04-10 02:28:19 on Problem 1017
#include<iostream>
using namespace std;
int main()
{
	int a[7];
	int b[7];
	int c[7];
	int i,sum,sumc;
	for(i=1;i<7;i++)
		a[i]=i*i;
	while(1)
	{
	 sum=0;
	for(i=1;i<7;i++)
	{
		cin>>b[i];
		sum=sum+b[i]*a[i];
	}
	cout<<sum<<endl;
	if(sum==0)
		break;
	else
	{
		for(i=6;i>=1;i--)
		{
			c[i]=sum/a[i];
			cout<<c[i]<<" ";
			sum=sum-c[i]*a[i];
			if(sum==0)
				break;
		}
	}
	cout<<endl;
	 sumc=0;
	for(i=1;i<7;i++)
		sumc+=c[i];
	cout<<sumc;
	cout<<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