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的更多相关文章
随机推荐
- <php>统计整个文件夹的大小
//用来统计一个目录下大小 function dirsize($file) { $size = 0; $dir = opendir($file); while($filename = readdir( ...
- maven install 报错Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of ...
- python3-day5(模块)
1.获取路径import os,sys #获取全部路径 print(os.path.abspath(__file__)) #获取目录 print(os.path.dirname(os.path.abs ...
- HDU1285——确定比赛名次
Problem Description 有N个比赛队(1<=N<=500),编号依次为1,2,3,....,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委 ...
- IOS 6.0+ Autolayout — UITableViewCell 高度调整
要实现的效果 要求: storyboard上的准备工作 建好cell自定义AutoCell 类,关联好控件,事先准备好一些数据源 实现tableview的委托方法 核心部分,HeightForRow方 ...
- Java Builder模式 体验(二)
在上篇文章中,对Java Builder模式的使用体验主要是从Builder对构造器改造方面的优秀特性来说的,感觉并没有从Java Builder模式本身的功能和作用去写,因此决定再从Build ...
- asp net 编程问题 实现下一篇 和上一篇效果
首先是access数据库,有一个名为news的表,里面有三个字段,分别为id,classid 和name 其中id为主键,classid可以重复 现在有以下数据: id classid name 1 ...
- oracle服务的开始和关闭 CMD
开始: @echo halt oracle service ...net start OracleServiceORCLnet start OracleOraDb11g_home1TNSListene ...
- struts 标签引用出错
几句句话概括 1.检查 web.xml 出现错误自己改 配置后filter jsp-config 2.检查 tld 目录下的东西 是否缺少 3. 将包复制到web的lib目录下后 之后 b ...
- <转> 纸牌屋1-4集分析
原文:http://blog.sina.com.cn/s/blog_b86c61490102v56t.html 第一季第一集 主人公弗兰克的出场,是以对待一只邻家将死之狗的态度展开的,充分显示了主人公 ...