借放一下程式碼,這題除了long long要注意其他都還好
#include <iostream> //AC e465 f605 i399 k918 k900 k920
#include <vector>
#include <algorithm>
#define fast_as_a_fuckboy ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
int main(){
fast_as_a_fuckboy
long long int a, b, ans;
vector<pair<int,int>> p;
while(cin >> a >> b){
p.push_back({a,b});
ans += (a*b);
}
sort(p.begin(),p.end());
reverse(p.begin(),p.end());
for(int i = 0;i < p.size();i++){
cout << p[i].first << "元鈔票共有" << p[i].second << "張\n";
}
cout << "總共有" << ans << "元";
}