有没有大佬可以捞捞,这个代码错在哪里了TAT
  • 板块学术版
  • 楼主confusing
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/3/24 20:22
  • 上次更新2024/3/24 22:02:41
查看原帖
有没有大佬可以捞捞,这个代码错在哪里了TAT
1321492
confusing楼主2024/3/24 20:22
<
  #include<iostream>
using namespace std;

int main(){

    char score[62503];
    int s[10100][2];
    int j = 0;
    
    int win_11 = 0;
    int lose_11 = 0;
    //记录11制一局比分
    
    int win_21 = 0;
    int lose_21 = 0;
    //记录21制一局比分
    
    int w_11 = 0;
    int l_11 = 0;
    //记录11胜场
    
    int w_21 = 0;
    int l_21 = 0;
    //记录21胜场
    
    for(int i = 0;cin >> score[i] && score[i]!='E' ;i++)
    {
        
        if(score[i] == 'W')
            win_11++;
            win_21++;
        
        if(score[i] == 'L')
            lose_11++;
            lose_21++;

        //11
        if((win_11 >= 11 && win_11-lose_11 >= 2 ) || ( lose_11 >= 11|| lose_11-win_11 >= 2))
        {
            cout << win_11 <<":"<<lose_11 <<endl;
            
            if(win_11 > lose_11)
                w_11++;
            else
                l_11++;
                
            win_11 = 0;
            lose_11 = 0;
        }
        
        //21
        if((win_21 >= 21 && win_21-lose_21 >= 2 ) || ( lose_21 >= 21|| lose_21-win_21 >= 2))
        {
            //cout << win_21 <<":"<<lose_21 <<endl;
            s[j][0] = win_21;
            s[j][1] = lose_21;
            j++;
            
            if(win_21 > lose_21)
                w_21++;
            else
                l_21++;
                
            win_21 = 0;
            lose_21 = 0;
        }
        
    }
    
    cout << w_11 <<":"<< l_11 <<endl;
    cout << endl;
    
    for(int i = 0;i < j ;i++)
    {
        cout << s[i][0] <<":"<<s[i][1] <<endl;
    }
    cout << w_21 <<":" << l_21 <<endl;
    
    return 0;

}
                                      >
2024/3/24 20:22
加载中...