| ||||||||||
| 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 <iostream>
#include <algorithm>
using namespace std;
double a[100];
bool cmp(double a,double b)
{
return a < b;
}
int main()
{
int i,co;
while(scanf("%lf",&a[0]) && a[0] != -1)
{
i = 1;
co = 0;
while(scanf("%lf",&a[i]) && a[i] != 0) i++;
sort(a,a + i,cmp);
for(int ci = 0; ci < i;ci++)
for(int j = ci + 1;j < i;j++)
{
if(a[ci] == a[j] / 2)
co ++;
}
printf("%d\n",co);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator