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

这样为什么是wrong answer??

Posted by akheyun at 2008-03-22 12:43:15 on Problem 2209
#include"stdio.h"
void main()
{
	int sons,n,a[100],i,sum,j,temp;
	sum=0;
	scanf("%d",&sons);
	scanf("%d",&n);
	for(i=0;i<sons;i++)
		scanf("%d",&a[i]);
	for(i=0;i<sons;i++)
		if(a[i]>=0)
		{	
			temp=a[i];
			for(j=1;j<n;j++)
				a[i]*=temp;
		}
	for(i=0;i<sons;i++)
		if(a[i]>=0)
			sum+=a[i];
	printf("%d\n",sum);
}

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