1 条题解

  • 0
    @ 2023-9-17 15:45:22

    #include<iostream> #include<string> #include <algorithm> using namespace std; int main() { string n; cin>>n; int r,g,b; r=g=b=0; sort(n.begin(),n.end()); cout<<n<<endl; for(int i=0;i<n.size();i++) { if(n[i]'R') { r++; }else if(n[i]'G') { g++; }else if(n[i]'B') { b++; } } if(r/1g/2==b/3){ cout<<r; }else{ if(r<=g/2&&r<=b/3){ cout<<r; }else if(g/2<=r&&g/2<=b/3){ cout<<g/2; }else if(b/3<=r&&b/3<=g/2){ cout<<b/3; } } return 0; }

    • 1

    信息

    ID
    88
    时间
    1000ms
    内存
    256MiB
    难度
    7
    标签
    递交数
    187
    已通过
    49
    上传者