为什么 10 分???
查看原帖
为什么 10 分???
130897
璀璨星空1楼主2019/1/5 08:31
#include<bits/stdc++.h>
using namespace std;
const int X=1000;
char team[X];
void SOLVE(int n,int m)
{
    int one=0,zero=0;
    if(m<n) return;
    for(int i=n;i<=m;i++)
    {
        if(team[i]=='0') ++zero;
        else ++one;
    }
    if(one==0) cout<<'A';
    else if(zero==0) cout<<'B';
    else
    {
        cout<<'C';
        SOLVE(n,(n+m)/2);
    	SOLVE((n+m)/2+1,m);
    }
    return;
}
int main()
{
    gets(team);
    SOLVE(0,strlen(team)-1);
    cout<<endl;
    system("pause");
    return 0;
}
2019/1/5 08:31
加载中...