POJ.1552 Doubles(水)

题意分析

暴力

代码总览

#include <cstdio>
#include <stdio.h>
#define nmax 100
using namespace std;
int a[nmax];
int n;
int main()
{
//freopen("in.txt","r",stdin);
while(true){
int t;
scanf("%d",&t);
if(t == -1) break;
if(t == 0){
printf("0\n");
continue;
}else{
int cnt = 0;
a[cnt++] =t;
while(scanf("%d",&t) && t!= 0){
a[cnt++] = t;
}
int ans = 0;
for(int i = 0; i<cnt;++i){
for(int j = 0; j<cnt;++j){
if(i == j) continue;
else{
if(a[j] == 2* a[i]) ans++;
}
}
}
printf("%d\n",ans);
}
}
return 0;
}

POJ.1552 Doubles(水)的更多相关文章

  1. Poj 1552 Doubles(水题)

    一.Description As part of an arithmetic competency program, your students will be given randomly gene ...

  2. POJ 1552 Doubles (C++ STL set使用)

    题目: 题意:题意:给出几个正数(2~15个),然后就是求有这些数字的2倍有没有和原先的正数相同的,求出有几个,没有就是0. 分析:水题.用数组解决,开一个数组存正数,另开一个数组用来存这些数的2倍, ...

  3. poj 1552 Doubles

    #include <stdio.h> #include <stdlib.h> ]; int cmp(const void *a, const void *b) { return ...

  4. 【转】POJ百道水题列表

    以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...

  5. POJ.1003 Hangover ( 水 )

    POJ.1003 Hangover ( 水 ) 代码总览 #include <cstdio> #include <cstring> #include <algorithm ...

  6. POJ 3050 Hopscotch 水~

    http://poj.org/problem?id=3050 题目大意: 在一个5*5的格子中走,每一个格子有个数值,每次能够往上下左右走一格,问走了5次后得到的6个数的序列一共同拥有多少种?(一開始 ...

  7. poj 3264 RMQ 水题

    题意:找到一段数字里最大值和最小值的差 水题 #include<cstdio> #include<iostream> #include<algorithm> #in ...

  8. POJ 1836 Alignment 水DP

    题目: http://poj.org/problem?id=1836 没读懂题,以为身高不能有相同的,没想到排中间的两个身高是可以相同的.. #include <stdio.h> #inc ...

  9. POJ 1837 Balance 水题, DP 难度:0

    题目 http://poj.org/problem?id=1837 题意 单组数据,有一根杠杆,有R个钩子,其位置hi为整数且属于[-15,15],有C个重物,其质量wi为整数且属于[1,25],重物 ...

随机推荐

  1. eclipse导入jmeter3.1源码并运行

    jmeter3.1源码地址:https://archive.apache.org/dist/jmeter/source/ 1.打开eclipse,新建一个java project的项目,并点击next ...

  2. VueJs 学习笔记

    VueJs学习笔记 参考资料:https://cn.vuejs.org/ 特效库:TweenJS(补间动画库)  VelocityJS(轻量级JS动画库) Animate.css(CSS预设动画库) ...

  3. 2019年猪年海报PSD模板-第八部分

    11套精美猪年海报,免费猪年海报,下载地址:百度网盘,https://pan.baidu.com/s/1Y3wc_r7O-Dp0mLCihJ9mtQ            

  4. 2019年猪年海报PSD模板-第七部分

    14套精美猪年海报,免费猪年海报,下载地址:百度网盘,https://pan.baidu.com/s/1pE3X9AYirog1W8FSxbMiAQ              

  5. leetcode-电话号码的字母组合

    电话号码的字母组合 给定一个仅包含数字 2-9 的字符串,返回所有它能表示的字母组合. 给出数字到字母的映射如下(与电话按键相同).注意 1 不对应任何字母. 示例: 输入:"23" ...

  6. chrome编辑器与截图

    在地址栏中输入 data:text/html,<html contenteditable>即可使用编辑功能,打开控制台,ctrl + shift + p 调用命令面板,输入 capture ...

  7. matconv-GPU 编译问题

    如出现以下错误: 1 error detected in the compilation of "C:/Users/Justin/AppData/Local/Temp/tmpxft_0000 ...

  8. MATLAB画图符号标注

    线型 说明 标记符 说明 颜色 说明 - 实线(默认) + 加号符 r 红色 -- 双划线 o 空心圆 g 绿色 : 虚线 * 星号 b 蓝色 :. 点划线 . 实心圆 c 青绿色 x 叉号符 m 洋 ...

  9. Js全反选DataGrid

    // **************************************************************** // // function Trim(value) // -- ...

  10. 左值&右值

    一.引子 我们所谓的左值.右值,正确的说法应该是左值表达式.右值表达式. 因为C++的表达式不是左值就是右值. 在C中,左值指的是既能够出现在等号左边也能出现在等号右边的表达式,右值指的则是只能出现在 ...