| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
大神求救!为什么一直WA!!!!
本来是用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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator