From cd7d854697563fd054fe3fba57938410643d35fa Mon Sep 17 00:00:00 2001 From: KiritoTRw <3021577574@qq.com> Date: Wed, 27 Apr 2016 18:37:22 +0800 Subject: [PATCH] Create 1437.cpp --- QUSTOJ/1437.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 QUSTOJ/1437.cpp diff --git a/QUSTOJ/1437.cpp b/QUSTOJ/1437.cpp new file mode 100644 index 0000000..045ad06 --- /dev/null +++ b/QUSTOJ/1437.cpp @@ -0,0 +1,41 @@ +#include +#include +#include +#include + +using namespace std; +class pack +{ +public: + int real; + int absed; + pack(int a):real(a),absed(abs(a)) {} +}; + +bool cmp(const pack& a,const pack& b) +{ + return a.absed>b.absed; +} + +int main() +{ + int n; + while(cin>>n) + { + if(n==0) return 0; + vector bus; + for(int i=0; i>tmp; + bus.push_back(pack(tmp)); + } + sort(bus.begin(),bus.end(),cmp); + for(int i=0; i