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