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

查点被气死,打成X了……

Posted by sogo at 2010-03-29 17:53:06 on Problem 1555
# include "stdio.h"
# include "math.h"
int a[10];
int main()
{
	int i, count;
	while(scanf("%d",&a[0])!=-1)
	{
		for( i=1, count=0; i<=8; i++ )
			scanf("%d",&a[i]);
		for( i=0; i<=8; i++ )
		{	
			if(a[i]!=0)
			{
				if(count) printf(" ");
				if(count)
				{
					if(a[i]>0) printf("+ ");
					else printf("- ");
				}
				else if(a[i]<0) printf("-");
				if((a[i]!=1&&a[i]!=-1)||(i==8))
				{
					if(a[i]<0) printf("%d",-a[i]);
					else printf("%d",a[i]);
				}
				if(i!=8)
				{
					printf("x");
					if(i!=7)
						printf("^%d",8-i);
				}
				count++;
			}
		}
		if(count==0) printf("0");
		printf("\n");
	}
	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