Doubles
时间限制:1000MS  内存限制:65535K

Description
As part of an arithmetic competency program, your 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. 
输入格式
The input file 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.

输出格式
The output will consist of one line per input list, containing a count of the items that are double some other item.
输入样例
1 4 3 2 9 7 18 22 0
2 4 8 10 0
7 5 11 13 1 3 0
-1

输出样例
3
2
0

#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <map>
#include <iostream>
#include <bitset>
#include <algorithm>
using namespace std;
int main() {int n[20],one,tiwce[20];while(scanf("%d",&one),one>0){int i=0,c=0;n[i]=one;tiwce[i++]=one*2;while(scanf("%d",&one),one){n[i]=one;tiwce[i++]=one*2;}sort(n,n+i);sort(tiwce,tiwce+i);for(int x=1;x<i;++x){for(int y=0;y<i;++y)if(n[x]==tiwce[y])++c;}printf("%d\n",c);}return 0;
}

为升级数,特切水题一道。

深夜切题——Doubles相关推荐

  1. 深夜切题——PAT (Basic Level)-1015

    1015. 德才论 (25) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Li 宋代史学家司马光在<资治通鉴&g ...

  2. 滴滴大整改:9月8日至15日暂停深夜叫车服务

    9 月 4 日晚间,滴滴出行正式对外宣布,将于 9 月 4 日启动安全大整治.并宣布,在在以下主要措施落地前,滴滴出行将于 9 月 8 日 23 点至 9 月 15 日凌晨 5 点期间在中国大陆地区暂 ...

  3. 一分钟AI | Numpy将放弃Python2.7全面支持Python3,柯洁苦战终结AI41连胜深夜失眠发文感慨

    一分钟AI 柯洁深夜发微博,庆祝自己击败已经41连胜的新锐围棋AI"符合预期" <时代>杂志评选 2017 年最佳发明榜单发布:iPhone X,特斯拉Model 3, ...

  4. 深夜,我偷听到程序员要对session下手……

    我是一个web服务器 我是一个web服务器,我的工作是给人类提供上网服务,我每天要为数以万计的人提供网页浏览服务. 已经是深夜了,我还在和手下几个兄弟为了一件事紧张讨论着. "老大,现在咱们 ...

  5. GitHub 推出 2020 宇宙新功能:Dark Mode!从此深夜搞开源不再被亮瞎了!

    很多开发者都有在晚上还要加班或搞搞开源的经历,在较黑暗的环境下,突然打开一个白底的页面就很容易被屏幕亮瞎眼.的确,作为一个长时间对着屏幕工作的人来说,呵护自己的双眼可是很重要的. 在最新的 GitHu ...

  6. 深夜,你的手机为谁开?

    深夜里你的手机为谁开 作词 作曲 演唱 牛朝阳 夜深深 房间里只有你一个人在 一盏灯也没有开 明月光 送进来一些树影摇摇摆摆 心情也跟着摇摆 情深深 思念象一个顽皮的小孩 蹦蹦跳跳扑过来 什么人 他让 ...

  7. [转]深夜无人的街道

    深夜无人的街道  ·方舟子· 把最后一缕阳光 深深锁进尘封的心头 夜幕沉沉如墓石 未曾诞生的梦想 就这样被再次埋葬 是的,这并不是一个特别的日子 我们的相遇纯属偶然 虽然末日的钟声正在天际闪耀 我们凝 ...

  8. 2017.1.19切题总结

    上午切了P1920 这道题是最优骗分+贪心 原题: 有N (1 <= N <= 1,000,000)个 true 或者false的问题. 其中答案是true的问题的个数有K种可能:t_1, ...

  9. 恒丰银行深夜紧急澄清!“我行与建设银行的报道严重不实”!恒丰银行称目前自身经营稳定有序

    深夜紧急澄清!"我行与建设银行的报道严重不实"!恒丰银行称目前自身经营稳定有序 5月24日晚间,总部位于山东的恒丰银行发布公告称,"个别媒体刊发有关我行与中国建设银行的报 ...

最新文章

  1. 从Visual Studio里抓取抽象语法树(AST)
  2. 爱立信和威瑞森电信使用VR流式车来测试5G
  3. python基础包括什么-Python基础题
  4. 同济大学计算机系陈永生,城市轨道交通应急预案演算平台的设计与研究.pdf
  5. css 实现app图标样式_uni-app开发一个小视频应用(一)
  6. Android之FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
  7. Struts2_2_第一Struts2应用
  8. mysql设置账号过期
  9. String s = new String(“hello“)创建了几个对象(图解)
  10. oracle 10g crs_stop -all 命令后遇到 UNKNOWN
  11. 爬虫进阶 -- 爬虫相关定义、反爬机制及其破解
  12. subplot()函数--Matplotlib
  13. 浅谈SQL语言的特点
  14. 【模型5.0】幸福sharp模型:让优势带动劣势
  15. 获得内核函数地址的四种方法
  16. MySQL优化之hints
  17. 2023最新SSM计算机毕业设计选题大全(附源码+LW)之java小型超市货物仓储管理系统w8wry
  18. 班级校园网页设计作业 静态HTML我的班级网页 DW班级网站模板 大学生简单班级网页作品代码 我的大学网页制作 学生班级网页设计作业
  19. UT2011学习笔记
  20. 刷步数作弊成了朋友圈必备技能

热门文章

  1. Briefings in bioinformatics2022 | 基于神经网络的分子性质预测通用优化策略
  2. Netlogon特权提升漏洞
  3. VM虚拟机双网卡配置
  4. win10计算机网络共享打不开,windows10系统打不开WiFi热点如何修复
  5. 2019年最新网盘搜索引擎汇总
  6. Scons安装和使用
  7. Unity3D-设置地形
  8. html 93c,对93c46编程
  9. 第二篇学会感谢身边的所有人!
  10. unity3d占用内存太大解决方法