1303 Double
来源:互联网 发布:深圳it外包公司 编辑:程序博客网 时间:2024/04/30 20:18
排序加判断,这代码略水,见谅见谅
#include<iostream> #include<cstring> #include<sstream> #include<algorithm> #include<cstdio> #include<cmath> #include<string> #include<iomanip> using namespace std; const int MAX = 100100; int main() { int a[20]; int n,i,j,k,cnt; while(true) { cnt = 0; cin>>a[0]; if(a[0] == -1) break; for(i=1;i<20;i++) {cin>>n; if(n==0) break; a[i] = n; } k = i; sort(a,a+k); for(i=0;i<k;i++) { for(j=1;j<k;j++) if(a[j] == a[i]*2) {cnt++; break;} } cout<<cnt<<endl; } return 0; }
0 0
- 1303 Double
- Double
- Double
- double
- 水题~HDU 1303 Double 题解+直接暴力
- double 和 long double
- double ceil(double x);
- double*对象*double
- double vs long double
- double OS
- double check
- Double-Take
- Double-dispatching
- Double Buffering
- double dispatch
- Double String
- double free
- double运算
- JAVA 输入输出txt三种方法
- 中国软件开发工程师之痛
- hdu 1045 Fire Net
- POJ 2002 - Squares(hash)
- mbed OS - ARM关于物联网(IoT)的战略布局
- 1303 Double
- hdu 1879 继续畅通工程 最小生成树入门模板题
- [LeetCode]Find Peak Element
- 寒假刷oj—— 关于字符串将str1和str2连接起来放入str3
- OpenVPN 所有linux版本rpm包下载地址
- 【POJ 2079】Triangle
- Android 为什么AlertDialog 里不能使用getapplicationcontext
- 分享下各个网站
- 关于unregister_chrdev