萌新求助2,9,10三点re
查看原帖
萌新求助2,9,10三点re
534430
amxxxxx楼主2022/8/7 15:31
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const ll N=1e5+10;
ull mod = 1000000000000002493;
string has[N];
string a[N];
bool check(string str){
    int x=0;
    for(int i=0;i<str.length();i++){
        x+=str[i];
    }
    x%=mod;
    while(has[x][0]){
        if(str==has[x])return true;
        x++;
        x%=mod;
    }
    has[x]=str;
    return false;
}
int main(){
    int n;
    int sum=0;
    bool flag=false;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(!check(a[i]))flag=true;
        if(flag)sum++;
        flag=false;
    }
    cout<<sum;
    system("pause");
    return 0;
}
2022/8/7 15:31
加载中...