51 nod 1090 3个数和为0
来源:互联网 发布:json对象如何转成数组 编辑:程序博客网 时间:2024/05/29 02:56
与1001类似 把代码稍微改了改
#include <queue>#include <stdio.h>#include <iostream>#include <stdlib.h>#include <cmath>#include<algorithm>using namespace std;int main(){ int n; while(cin>>n){ bool temp=false; int Array[n]; for(int i = 0 ;i < n;i++){ cin>>Array[i]; } sort(Array,Array+n); for(int i = 0; i < n ;i++) { if(Array[i]+Array[n-1]+Array[n-2]<0) continue; for(int j = i+1;j < n;j++){ for(int z = j +1 ; z < n&&Array[i]+Array[j]+Array[z]<=0;z++) { if(Array[i]+Array[j]+Array[z]==0) { temp=true; cout<<Array[i]<<" "<<Array[j]<<" "<<Array[z]<<endl; } } } } if(!temp) cout<<"No Solution"<<endl; } return 0;}
0 0
- 3个数和为0 51Nod
- 51nod 1090 3个数和为0
- 51nod 1090 3个数和为0
- 51nod 1090 3个数和为0 (二分_stl)
- 51 nod 1090 3个数和为0
- 51nod 1090 3个数的和为0
- 51nod 1090 3个数和为0
- 51Nod-1090-3个数和为0
- 51Nod 1090 3个数和为0
- 51nod 1090 3个数和为0(二分)
- 51nod-1090 3个数和为0
- 51nod-【1090 3个数和为0】
- 51nod 1090 3个数和为0
- 51NOD 1090 3个数和为0
- 51Nod 1090 3个数和为0 (二分
- 51nod 1090 3个数和为0(二分)
- 【51Nod】1090 3个数和为0
- 51Nod 1090 3个数和为0
- android L 关机流程分析
- hdu 3336 Count the string KMP模式匹配 ★★★
- Angular JS 入门学习
- 使用Sublime Text 3 编译并运行Java程序
- DeepLearningToolBox学习——RBM(Restrict Boltzmann Machine)II
- 51 nod 1090 3个数和为0
- hdu 2256
- WFS至要素类
- suricata安装配置
- 运维笔记
- 浅谈操作系统对内存的管理
- 最少硬币问题
- 【BLE】CC2541之设置发射功率
- 一个窗帘引发的——关于测试及测试活动的思考(一)