2 条题解

  • 0
    @ 2025-8-1 13:19:17
    #include<iostream>
    #include<string>
    #include <sstream>
    using namespace std;
    //暴力完成版
    int main(){
        int x,y,z;
        string num;
        getline(cin,num); 
        istringstream word(num);
        char comma1,comma2; 
        if (word >> x >> comma1 >> y >> comma2 >> z){
        	//比大小功能实现部分;
    	    if (x>y){
    	        if(x>z){
    	            if(y>z){
    	                cout<<z<<" "<<y<<" "<<x;
    	            }
    	            else{
    	                cout<<y<<" "<<z<<" "<<x;
    	            }
    	        }
    	        else{
    	            cout<<y<<" "<<x<<" "<<z;
    	        }
    	    }
    	    else{
    	        if(y>z){
    	            if(z>x){
    	                cout<<x<<" "<<z<<" "<<y;
    	            }
    	            else{
    	                cout<<z<<" "<<x<<" "<<y;
    	            }
    	        }
    	        else{
    	            cout<<x<<" "<<y<<" "<<z;
    	        }
    	    }
    	}else {
            cerr << "输入格式错误,请确保输入三个用逗号分隔的整数!" << endl;
        }
        return 0;
    }
    
    

    信息

    ID
    289
    时间
    1000ms
    内存
    128MiB
    难度
    6
    标签
    递交数
    932
    已通过
    269
    上传者