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 490953931 at 2016-07-19 16:12:13 on Problem 1552
本来是用sort排序后处理的,一直WA,后来看同学是没排序,AC了,我就也改成不排序,可还是WA,求大神解救!!!!!!!!!
#include <stdio.h>

int main(){
	int a[20];
	int x=0,i,j,s;
	while(scanf("%d",&a[x++])!=EOF){
		if(a[x-1]==-1)	break;
		
		if(a[x-1]==0){		
			

			
			for(i=0;i<x-1;i++){
				for(j=0;j<i;j++)
					if(a[j]*2==a[i]||a[i]*2==a[j]){
						s++;
				}
			}
			printf("%d\n",s);
			s=x=0;
		}
	}
	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