POJ 1552
来源:互联网 发布:pkpm钢结构计算软件 编辑:程序博客网 时间:2024/06/05 18:41
题意:输入一串数字,以0标志结束,搜索该串数字中,某个数字是其他数字2倍的这样数字的个数,-1标志文件结束。
题目很简单= =就是挨个搜索比较。。。
代码:
#include<iostream>
usingnamespace std;
intmain()
{
int a[16],i,j,num,count;
while(cin>>num&&num!=-1)
{
count=0;
memset(a,0,sizeof(a));
for(i=0;num!=0;i++)
{
a[i]=num;
cin>>num;
}
for(i=0;a[i]!=0;i++)
for(j=0;a[j]!=0;j++)
if(a[j]*2==a[i])count++;
cout<<count<<endl;
}
return 0;
}
using
int
{
}
- POJ 1552 Doubles (水题)
- POJ 1552
- poj 2488
- POJ 3299
- poj 1905
- POJ 2485 Highways
- POj 1017 Packets
- poj 1020 搜索
- poj 3278 宽搜
- poj 1426 宽搜
- poj 1925 Spiderman
- poj 3259 Wormholes
- POJ 2160 BOX
- POJ 2190 ISBN
- poj 3299 humidex
- poj 2253 Frogger
- poj 2485 Highways
- poj 3041 Asteroids
- poj 1226
- poj 1226(转)
- POJ 1401
- 点名,你随意
- POJ 1504
- POJ 1552
- C++学习书籍推荐
- POJ 1607
- POJ 1657
- POJ 1674
- POJ 1799
- POJ 1862
- POJ 1906
- POJ 1922