这题啥意思?

P1042 [NOIP2003 普及组] 乒乓球

DougNo1 @ 2024-08-19 10:41:00

本蒟蒻看不懂题目,请大佬们帮帮我,谢谢!


by abc20131113 @ 2024-08-26 18:12:02

这题是真难懂(我花了半个小时才看懂啊喂


by abc20131113 @ 2024-08-26 18:16:12

@DYH0715 @Machuanqi99 给个代码总能看懂了吧(看不懂我就没办法了) 下面是代码:


#include<bits/stdc++.h>  
using namespace std;  
long long c[100000],d[100000];  
int main(){  
//  freopen(".in","r",stdin);  
//  freopen(".out","w",stdout);  
    char x;  
    long long y=0,z=0,a=0,b=0;  
    while(x!='E'){  
        cin>>x;  
        if(x=='W'){  
            c[z]++;  
            a++;  
        }  
        if(x=='L'){  
            b++;  
            d[z]++;  
        }  
        if(x=='E'){  
            cout<<a<<":"<<b<<endl;  
            break;  
        }  
        if((a>=11||b>=11)&&(a-b>=2||b-a>=2)){  
            cout<<a<<":"<<b<<endl;  
            a=0;b=0;  
        }  
        if((c[z]>=21||d[z]>=21)&&(c[z]-d[z]>=2||d[z]-c[z]>=2)){  
            z++;  
        }  
    }  
    cout<<endl;  
    for(int i=0;i<=z;i++){  
        cout<<c[i]<<":"<<d[i]<<endl;  
    }  
    return 0;  
}

by kkksc_03dad @ 2024-08-27 07:50:50

@abc20131113 懂了


by abc20131113 @ 2024-08-28 21:02:34

@DYH0715 可以关注我吗


上一页 |