您的位置:首页 > 其它

ZOJ 1760 多少个两倍数

2010-05-12 11:04 225 查看
//////////////////////////////////////////
#include<iostream>
#include<algorithm>
using namespace std;
int st[16];

int main()
{
int i;
int ans;
while(cin>>st[0] && st[0]!=-1)
{
ans=0;
i=1;
while(cin>>st[i] && st[i]!=0)
i++;
sort(st,st+i);
int j,k;
for(j=0;j<i;j++)
for(k=j+1;k<i;k++)
if(st[k]==2*st[j])
ans++;

cout<<ans<<endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: