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

水好深啊!

Posted by chenxuan123456789 at 2012-10-25 21:31:22 on Problem 1552
#include <stdio.h>
int number[20];
int main()
{
    int i,j,count,flag=0,k;
    while(1)
    {
            i=0;
            count=0;
            while(scanf("%d",&number[i])!=EOF)
            {
            if(number[i]==-1)
            {
                             flag=1;
                             break;
            }
            if(number[i]==0)
            break;
			i++;
            }
            if(flag)
            break;
		  for(j=0;j<i;j++)
            {
                            for(k=j+1;k<i;k++)
                            if(number[j]==2*number[k]||number[j]*2==number[k])
                            count++;
            }
            printf("%d\n",count);
            }
    return 1;
}

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