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 changzhiwin at 2008-07-23 17:43:10 on Problem 1552
#include<stdio.h>
#include<string.h>
int main()
{
    bool a[100];
    int n,i;
    int temp;
    int max,min;
    while(scanf("%d",&n)==1)
    {
          if(n==-1)break;
          max=-1;
          min=100100;
          memset(a,0,sizeof(a));
          a[n]=true;
          if(min>n)min=n;
          if(max<n)max=n;
          while(1)
          {
              scanf("%d",&n);
              if(n==0)break;
              a[n]=true; 
              if(min>n)min=n;
              if(max<n)max=n;       
          }             
          temp=0;
          for(i=min;i<=49;i++)
          {
              if(a[i]&&a[i*2])temp++;                 
          }           
          printf("%d\n",temp);
    }    
}

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