poj1552
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 18824 | Accepted: 10846 |
Description
1 4 3 2 9 7 18 22
your program should answer 3, as 2 is twice 1, 4 is twice 2, and 18 is twice 9.
Input
input will consist of one or more lists of numbers. There will be one
list of numbers per line. Each list will contain from 2 to 15 unique
positive integers. No integer will be larger than 99. Each line will be
terminated with the integer 0, which is not considered part of the list.
A line with the single number -1 will mark the end of the file. The
example input below shows 3 separate lists. Some lists may not contain
any doubles.
Output
Sample Input
1 4 3 2 9 7 18 22 0
2 4 8 10 0
7 5 11 13 1 3 0
-1
Sample Output
3
2
0
Source
#include <iostream>
#include<cstring>
using namespace std; int main()
{
int a[];
cin>>a[];
while(a[]!=-)
{
int n =;
int ans = ;
for(;;n++)
{
cin>>a[n];
if(a[n]==)
break;
}
for(int i=;i<n-;i++)
{
for(int j=i+;j<n;j++)
if(a[i]*==a[j]||a[i]==a[j]*)
ans++;
}
cout<<ans<<endl;
memset(a,,sizeof(a));
cin>>a[];
}
return ;
}
poj1552的更多相关文章
随机推荐
- 关于初学者上传文件到github的方法
转:http://blog.csdn.net/steven6977/article/details/10567719 说来也惭愧,我是最近开始用github,小白一个,昨天研究了一个下午.终于可以上传 ...
- iOS 使用pods报错问题 pod --version
错误信息如下 find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException) from /Us ...
- #爬虫必备,解析html文档----beautifulsoup的简单用法
#出处:http://mp.weixin.qq.com/s?__biz=MjM5NzU0MzU0Nw==&mid=201820961&idx=2&sn=b729466f334d ...
- text-overflow简单使用
text-overflow属性配合overflow才有效果,还记得把文字强制一行显示,如下代码: <!DOCTYPE html> <html lang="zh-cn&quo ...
- iOS开发:深入理解GCD 第一篇
最近把其他书籍都放下了,主要是在研究GCD.如果是为了工作,以我以前所学的GCD.NSOperation等知识已经足够用了,但学习并不仅仅知识满足于用它,要知其然.并且知其所以然,这样才可以不断的提高 ...
- (转)iOS7人机界面设计规范 - 目录
英文原文出自苹果官方的iOS7设计资源-iOS人机界面设计规范(预发布版本),由C7210自发翻译,并首发于Beforweb.com.如需转载,请注明译者及出处信息. UI设计基础 为iOS7而设计 ...
- Git冲突解决方案
Git冲突解决方案 1. 在代码提交时,先更新,若有冲突.先解决冲突.若提交之后在review时才发现无法合并代码时有冲突,需要abandon此次提交的代码. 2. 解决冲突的基本做法,保存本地代 ...
- HR系统+人脸识别
近期一直在写一套HR系统,这套HR系统和人脸识别相结合.全然杜绝取代刷卡的情况产生.系统的灵活性比較强,开发简洁高速. 例如以下是一些功能上的截图 考勤模块仅仅是列举当中一个请假申请的功能做为展示 ...
- 找工作笔试面试那些事儿(10)---SQL语句总结
SQL语句中常用关键词及其解释如下: 1)SELECT 将资料从数据库中的表格内选出,两个关键字:从 (FROM) 数据库中的表格内选出 (SELECT).语法为 SELECT "栏位名&q ...
- [RxJS] Combining Streams with CombineLatest
Two streams often need to work together to produce the values you’ll need. This lesson shows how to ...