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

Re:来贴一下!!!!继续加油!!!

Posted by wangjiayu at 2010-03-10 19:49:30 on Problem 1017
In Reply To:来贴一下!!!!继续加油!!! Posted by:win1611 at 2010-02-02 14:38:43
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int i,a[10],s,m,sum;
    while(1)
	{
		s=0;
		for(i=1;i<=6;i++)
		{
			cin>>a[i];
			sum+=a[i];
		}
		s=a[1]*1+a[2]*4+a[3]*9+a[4]*16+a[5]*25+a[6]*36;
		if(s==0)
			break;
		m=s/36;
		if(s%36>25)
		{
			m+=s%36/25;
			if(s%36%25>16)
			{
				m+=s%36%25/16;
				if(s%36%25%16>9)
				{
					m+=s%36%25%16/9;
					if(s%36%25%16%9>4)
					{
						m+=s%36%25%16%9/4;
						if(s%36%25%16%9%4>=1)
						{
							m+=s%36%25%16%9%4;
						}
						else
						{
							cout<<m<<endl;
						}
					}
					else if((s%36%25%16%9<4)&&(s%36%25%16%9>=1))
					{
						m+=s%36%25%16%9;
						cout<<m<<endl;
					}
					else if(s%36%25%16%9==0)
					{
						cout<<m<<endl;
					}
				}
				else if((s%36%25%16<9)&&(s%36%25%16>=4))
				{
					m+=s%36%25%16/4;
					if(s%36%25%16%4>1)
					{
						m+=s%36%25%16%4;
						cout<<m<<endl;
					}
					else
					{
						cout<<m<<endl;
					}
				}
				else if((s%36%25%16<4)&&(s%36%25%16>=1))
				{
					m+=s%36%25%16;
						cout<<m<<endl;
				}
				else if(s%36%25%16==0)
				{
					cout<<m<<endl;
				}
			}
			else if((s%36%25<16)&&(s%36%25>=9))
			{
				m+=s%36%25/9;
				if(s%36%25%9>=4)
				{
					m=s%36%25%9/4;
					if(s%36%25%9%4>=1)
					{
						m+=s%36%25%9%4;
						cout<<m<<endl;
					}
					else
					{
						cout<<m;
					}
				}
				else if((s%36%25%9<4)&&(s%36%25%9>=1))
				{
					m+=s%36%25%9;
					cout<<m<<endl;
				}
				else if(s%36%25%9==0)
				{
					cout<<m<<endl;
				}
			}
			else if((s%36%25<9)&&(s%36%25>=4))
			{
				m+=s%36%25/4;
				if(s%36%25%4>=1)
				{
					m+=s%36%25%4;
				}
				else
				{
					cout<<m<<endl;
				}
			}
			else if((s%36%25<4)&&(s%36%25>=1))
			{
				m+=s%36%25;
				cout<<m<<endl;
			}
			else if(s%36%25==0)
			{
				cout<<m<<endl;
			}
		}
		else if((s%36<25)&&(s%36>=16))
		{
			m+=s%36/16;
			if(s%36%16>=9)
			{
				m+=s%36%16/9;
				if(s%36%16%9>=4)
				{
					m+=s%36%16%9/4;
					if(s%36%16%9%4>=1)
					{
						m+=s%36%16%9%4;
						cout<<m<<endl;
					}
					else 
					{
						cout<<m<<endl;
					}
				}
				else if((s%36%16%9<4)&&(s%36%16%9>=1))
				{
					m+=s%36%16%9;
					cout<<m<<endl;
				}
				else if(s%36%16%9==0)
				{
					cout<<m<<endl;
				}
			}
			else if((s%36%16<9)&&(s%36%16>=4))
			{
				m+=s%36%16/4;
				if(s%36%16%4>=1)
				{
					m+=s%36%16%4;
					cout<<m<<endl;
				}
				else
				{
					cout<<m<<endl;
				}
			}
			else if((s%36%16<4)&&(s%36%16>=1))
			{
				m+=s%36%16;
				cout<<m<<endl;
			}
			else if(s%36%16==0)
			{
				cout<<m<<endl;
			}
		}
		else if((s%36<16)&&(s%36>=9))
		{
			m+=s%36/9;
			if(s%36%9>=4)
			{
				m+=s%36%9/4;
				if(s%36%9%4>=1)
				{
					m+=s%36%9%4;
					cout<<m<<endl;
				}
				else
				{
					cout<<m<<endl;
				}
			}
			else if((s%36%9<4)&&(s%36%9>=1))
			{
				m+=s%36%9;
				cout<<m<<endl;
			}
			else if(s%36%9==0)
			{
				cout<<m<<endl;
			}
		}
		else if((s%36<9)&&(s%36>=4))
		{
			m+=s%36/4;
			if(s%36%4>=1)
			{
				m+=s%36%4;
				cout<<m<<endl;
			}
			else
			{
				cout<<m<<endl;
			}
		}
		else if((s%36<4)&&(s%36>=1))
		{
			m+=s%36;
			cout<<m<<endl;
		}
		else if(s%36==0)
		{
			cout<<m<<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