90分求调
查看原帖
90分求调
1314767
RoutineZhou楼主2024/10/26 19:01
#include <iostream>
using namespace std;
char a[1001];
int main(){
    //freopen("poker.in","r",stdin);
    //freopen("poker.out","w",stdout);
    int n, ans = 0;
    char c, d;
    cin >> n;
    if(n == 1) {
        cout << 51;
        return 0;
    }
    for(int i = 1; i <= n*2; i++){
        cin >> a[i];
    }
    for(int i = 1; i <= n*2; i+=2){
        if(c == a[i] && d == a[i+1]) continue;
        c = a[i];
        d = a[i+1];
        for(int j = i+2; j <= n*2; j+=2){
            if(a[j] == c && a[j+1] == d && j % 2 == 1 && j != 1) ans++;     
        }
    }
    cout << 52-n+ans;
    return 0;
}
2024/10/26 19:01
加载中...