小美的跑腿代购,注意二维数组的输入,并且输出是需要从小到大排好序。
#includeusing namespace std; bool compare1(vector a , vector b){ if(a[1] != b[1]) return a[1] >b[1]; return a[0] a , vector b){ return a[0]> n >>m ; vector > mesg(n ,vector (2)); int v , w; for(int i=0 ; i > v >>w; mesg[i][0] = i+1; mesg[i][1] = v + w*2 ; } sort(mesg.begin() , mesg.end() , compare1); sort(mesg.begin() , mesg.begin()+m , compare2); for(int i =0 ;i 小团的神秘暗号,注意字符串的输入
#includeusing namespace std; int main(){ int n; cin >> n; cin.get(); string s; //getline之前必须cin.get() getline(cin,s); int l=0 ,r = s.size()-1; for(int i=0 ; i 0; --i){ if(s[i] == 'T') { r=i-1; break; } } while(l



