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;
}
#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;
}
相关文章推荐
- zoj 1760.Doubles
- zoj 3511 Cake Robbery 给一个N个点的环(就当它是个正多边形好了),每次沿着两个点切下去一刀,一共切M刀,刀与刀之间不会交叉,问切完以后边长最多的多边形的边长是多少
- ZOJ 2022题解,起初此题纠结了很久。方法没有用对,后经大牛指点恍然大悟,原来就是求1到N有多少是5的倍数,再求25的倍数,125的倍数如此循环。
- zoj 1760 Doubles
- ZOJ 1569 对于给定序列,问有多少子序列的和是m倍数
- 有这么一个数,当把它的最后一位(个位)挪到第一位的时候,得到的新数刚好是原来数的两倍。问这个数是多少?
- ZOJ 1204 一个集合能组成多少个等式
- zoj 1760 查找
- ZOJ 题目1610 Count the Colors(线段树求颜色及有多少段)
- ZOJ-1760
- Zoj 3529 A Game Between Alice and Bob 数论+博弈Nim 快速求数中有多少个素数因子
- ZOJ 1204 一个集合能组成多少个等式
- ZOJ 1760 Doubles
- Zoj 1119 POJ 1523 SPF 求关节点及删除关节点会出现多少个连通分量 Tarjan算法
- POJ 1552 & ZOJ 1760 & UVA2787
- ZOJ Problem Set–1760 Doubles
- zoj 3228 Searching the String 母串共包含多少子串(重叠和不重叠)
- zoj 1760 Doubles(set集合容器的应用)
- ZOJ 1760 &&POJ1552 Doubles (模拟)
- zoj 2836 Number Puzzle(容斥,求1到m有多少个数能被数组里任意一个整除)