求帮改(不喜勿喷)
查看原帖
求帮改(不喜勿喷)
1272861
LMR_Minecraft楼主2024/11/8 12:24
#include<iostream>
using namespace std;
int n;
int a[100], b[100], c[100], x[100];
string s[100], temp;
int main() {
	cin >> n;
	for (int i = 0; i < n; i++)cin >> s[i] >> a[i] >> b[i] >> c[i];
	for (int i = 0; i < n; i++) {
		for (int j = 1; j < n; j++) {
			if (a[i] > a[j]) {
				temp = s[i];
				s[i] = s[j];
				s[j] = temp;
			}
			else if (a[i] == a[j]) {
				if (b[i] > b[j]) {
					temp = s[i];
					s[i] = s[j];
					s[j] = temp;
				}
				else if (b[i] == b[j]) {
					if (c[i] > c[j]) {
						temp = s[i];
						s[i] = s[j];
						s[j] = temp;
					}
				}
			}
		}
	}
	for (int i = 0; i < n; i++)cout << s[i] << endl;
}
2024/11/8 12:24
加载中...