自己运行全对但交上来全WA,蒟蒻求助
查看原帖
自己运行全对但交上来全WA,蒟蒻求助
1047798
nahida_badminton楼主2023/8/7 17:09
#include <iostream>
using namespace std;

int main(){
    int num[3], a, b, c;
    cin >> num[0] >> num[1] >> num[2];
    char adsj[3];
    cin >> adsj;
    int maxx = 0, minn = 101;
    for (int i = 0; i < 3; i++){
    	if (num[i] >= maxx){
    		maxx = num[i];
		}
		if (num[i] <= minn){
			minn = num[i];
		}
	}
	for (int i = 0; i < 3; i++){
		if (num[i] != minn && num[i] != maxx){
			b = num[i];
		}
	}
	a = minn;
	c = maxx;
	if (adsj[0] == 'A'){
		cout << a;
	} else if (adsj[0] == 'B'){
		cout << b; 
	} else if (adsj[0] == 'C'){
		cout << c;
	}
	cout << " ";
	if (adsj[1] == 'A'){
		cout << a;
	} else if (adsj[1] == 'B'){
		cout << b; 
	} else if (adsj[1] == 'C'){
		cout << c;
	}
	cout << " ";
	if (adsj[2] == 'A'){
		cout << a;
	} else if (adsj[2] == 'B'){
		cout << b; 
	} else if (adsj[2] == 'C'){
		cout << c;
	}
	cout << endl;
    return 0;
}
2023/8/7 17:09
加载中...