Doubles water!!!!!!只会水题怎么破
Doubles
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 3927 Accepted Submission(s):
2732
students will be given randomly generated lists of from 2 to 15 unique positive
integers and asked to determine how many items in each list are twice some other
item in the same list. You will need a program to help you with the grading.
This program should be able to scan the lists and output the correct answer for
each one. For example, given the list
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.
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.
containing a count of the items that are double some other item.
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int n;
int a[];
//freopen("in.txt","r",stdin);
while(cin>>n&&n!=-)
{
int count=,i=,j=,sum=;
a[]=n;
while(cin>>a[count++]&&a[count-]!=);
count-=;
for(i=;i<count;i++)
{
for(j=;j<count;j++)
{
if(a[i]==*a[j])
sum++;
}
}
cout<<sum<<endl;
}
}
Doubles water!!!!!!只会水题怎么破的更多相关文章
- HDU 5443 The Water Problem (水题,暴力)
题意:给定 n 个数,然后有 q 个询问,问你每个区间的最大值. 析:数据很小,直接暴力即可,不会超时,也可以用RMQ算法. 代码如下: #include <cstdio> #includ ...
- HDU 5832 A water problem (水题,大数)
题意:给定一个大数,问你取模73 和 137是不是都是0. 析:没什么可说的,先用char 存储下来,再一位一位的算就好了. 代码如下: #pragma comment(linker, "/ ...
- Atcoder 水题选做
为什么是水题选做呢?因为我只会水题啊 ( 为什么是$Atcoder$呢?因为暑假学长来讲课的时候讲了三件事:不要用洛谷,不要用dev-c++,不要用单步调试.$bzoj$太难了,$Topcoder$整 ...
- HDU 5832 A water problem(某水题)
p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...
- hdu 2044:一只小蜜蜂...(水题,斐波那契数列)
一只小蜜蜂... Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Submission(s): Accepte ...
- HDU 5832 A water problem (带坑水题)
A water problem 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5832 Description Two planets named H ...
- SRM 584 第一次玩TopCoder。。。只水题一道。。。
第一次topcoder,以前老感觉没有资格去做tc,cf什么的,现在已经慢慢接触了. 感觉还可以,还是有让我们这些蒻菜安慰的水题. tc的确很好玩,用客户端比赛,还有各种规则,而且还是只编写一个类提交 ...
- hdu-5867 Water problem(水题)
题目链接: Water problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Othe ...
- Poj 1552 Doubles(水题)
一.Description As part of an arithmetic competency program, your students will be given randomly gene ...
随机推荐
- [Zookeeper研究]一 Zookeeper技术简介
最近的项目中使用到了Zookeeper.Kafka以及Storm.仔细研究了一下,觉得这几个开源项目对于搞分布式的人来说是非常有用的,所以想把自己的一点心得体会总结一下,希望能对大家有所帮助. 首先从 ...
- css3的滤镜模糊的效果
最近在做一个css3的滤镜模糊的效果,但是我发现,有些浏览器一点效果都没有,这是浏览器兼容性导致的,怕今后会忘记所以就先写下来,也希望可以帮到需要的小伙伴. 代码如下: div{//设置半透明滤镜效果 ...
- USBASP下载线制作教程
- aliyun 安装图形
yum安装图形界面: 1) yum groupinstall "X Window System" yum install xclock yum groupinstall -y &q ...
- ysql+heartbeat+DRBD+LVS实现mysql高可用
在企业应用中,mysql+heartbeat+DRBD+LVS是一套成熟的集群解决方案,通过heart+DRBD实现mysql的主 节点写操作的高可用性,而通过mysql+LVS实现数据库的主从复制和 ...
- java List与数组互转
数组转List:String[] arr = new String[] {"str1", "str2"};List<String> list = A ...
- 回归分析:非线性nlinfi
今天测试.这首题,真的很头疼,第一次看到这个题,就知道要用nlinefit函数做,但是我一个地方没搞清楚, 花了我40多分钟还没做也来. 最后终于是调用的函数出错了.主要是没有将一个列抽出来.一个二维 ...
- UESTC_秋实大哥与时空漫游 2015 UESTC Training for Graph Theory<Problem C>
C - 秋实大哥与时空漫游 Time Limit: 4500/1500MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Su ...
- LeeCode-Happy Number
Write an algorithm to determine if a number is "happy". A happy number is a number defined ...
- OpenWrt compiles
make -r world: build failed. Please re-run make with -j1 V=s to see what's going onmake: *** [world] ...