| ||||||||||
| 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 | |||||||||
超简单的方法!#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator