文章
20
粉丝
412
获赞
12
访问
163.4k
#include <iostream>
#include <vector>
#include <string.h>
#include <algorithm>
using namespace std;
struct Complex{
double real, imag;
};
bool cmp(Complex a, Complex b) {
double ma = a.real*a.real+a.imag*a.imag;
double mb = b.real*b.real+b.imag*b.imag;
if(ma != mb) return ma > mb;
else return a.imag < b.imag;
}
int main() {
vector<Complex> v;
Complex c;
int n;
char s[105];
while(cin >> n) {
for(int i = 0;i < n;i++) {
scanf("%s", &s);
if(strcmp(s, "Pop") == 0) {
if(v.empty()) {
cout << "empty" << endl;
continue;
}
else {
cout << v[0].real << "+i" << v[0].imag << endl;
v.erase(v.begin());
cout << "SIZE = " << v.size() << endl;
...
登录后发布评论
暂无评论,来抢沙发