2444 为啥报错

Jntm CSP-J2二等 2022-08-01 20:05:26 7

#include <bits/stdc++.h> using namespace std; struct jk { int x; string y, z; };

jk s[50002];

void qjk(int l, int r) { int i, j; jk mid; i = l; j = r; mid.x = s[(l + r) / 2].x; while (i <= j) { while (s[i].x < mid.x) i++; while (s[j].x > mid.x) j--;

    if (i <= j) {
        swap(s[i], s[j]);
        i++;
        j--;
    }
}
if (l < j)
    qjk(l, j);
if (i < r)
    qjk(i, r);

} int main() { double n, a, b, c, nm=0,mn=0,nb=0,bn=0; int m,i;

cin >> m;
for (int i = 1; i <= m; i++){ cin >> s[i].x >> s[i].y;
   bn+=s[i].x;
   if(s[i].y="C")
   nb+=s[i].x;
   if(s[i].y=="R")
   mn+=s[i].x;
   if(s[i].y=="F")
   nm+=s[i].x;
}
cout<<"Total: "<<bn<<" animals"<<endl;
cout<<"Total coneys: "<<nb<<endl;
cout<<"Total rats: "<<mn<<endl;
cout<<"Total frogs: "<<nm<<endl;
cout<<setprecision(2)<<fixed<<"Percentage of coneys: "<<bn/nb*100<<" %"<<endl;
cout<<setprecision(2)<<fixed<<"Percentage of rats: "<<mn/nb*100<<" %"<<endl;
cout<<setprecision(2)<<fixed<<"Percentage of frogs: "<<nm/nb*100<<" %";


return 0;

}

{{ vote && vote.total.up }}