全wa求调【哭】

P1591 阶乘数码

yzbzz147268 @ 2024-12-25 13:12:00


#include<bits/stdc++.h>
using namespace std;
int a[10010];
int main(){
    a[1]=1;
    int t,n,m,p=1,x=0;
    cin>>t;
    int k=t;
    while(k--){
        cin>>n>>m;
        for(int i=2;i<=n;i++){
            x=0;
            for(int j=1;j<=p;j++){
                a[j]=a[j]*i+x;
                x=a[j]/10;
                a[j]%=10;
            }
            while(x>0){
                a[p]=x%10;
                p++;
                x/=10;
            }   
        }
        int num=0;
        for(int i=1;i<=t;i++)
            if(a[i]==m)
                num++;
        cout<<num<<endl;
    }
    return 0;
}```

by Two_Chana_ball @ 2024-12-25 13:21:27

include<bits/stdc++.h>

using namespace std; int a[10010]; int main(){ a[1]=1; int t,n,m,p=1,x=0; cin>>t; int k=t; while(k--){ cin>>n>>m; for(int i=2;i<=n;i++){ x=0; for(int j=1;j<=p;j++){ a[j]=a[j]*i+x; x=a[j]/10; a[j]%=10; } while(x>0){ a[p]=x%10; p++; x/=10; }
} int num=0; for(int i=1;i<=t;i++) if(a[i]==m) num++; cout<<num<<endl; } return 0; }```


by litangzheng @ 2024-12-25 13:31:56

@Two_Chana_ball你打出来的什么击败东西


by Two_Chana_ball @ 2024-12-29 16:00:41

@litangzheng草你······


by hp13307747077 @ 2025-01-01 14:53:42

#include<bits/stdc++.h>
using namespace std;
int n;
struct node{
    string na,zw,xzw;
    long long bg;
    int le,h;
}ab[115];
int change(string a){
    if (a=="BangZhu") return 0;
    if (a=="FuBangZhu") return 1;
    if (a=="HuFa") return 2;
    if (a=="ZhangLao") return 3;
    if (a=="TangZhu") return 4;
    if (a=="JingYing") return 5;
    if (a=="BangZhong") return 6;
}
int cmp1(node x,node y){
    if (x.bg==y.bg) return x.h<y.h;
    else return x.bg>y.bg;
}
int cmp2(node x,node y){
    if (change(x.xzw)==change(y.xzw)){
        if (x.le==y.le) return x.h<y.h;
        return x.le>y.le;
    }
    return change(x.xzw)<change(y.xzw);
}

int main(){
    cin>>n;
    for (int i=1;i<=n;i++){
        cin>>ab[i].na>>ab[i].zw>>ab[i].bg>>ab[i].le;
        ab[i].h=i;
    }
    sort(ab+4,ab+1+n,cmp1);
    for (int i=1;i<=n;i++){
        if (i==1) ab[i].xzw="BangZhu";
        else if (i==2||i==3) ab[i].xzw="FuBangZhu";
        else if (i==4||i==5) ab[i].xzw="HuFa";
        else if (i>=6&&i<=9) ab[i].xzw="ZhangLao";
        else if (i>=10&&i<=16) ab[i].xzw="TangZhu";
        else if (i>=17&&i<=41) ab[i].xzw="JingYing";
        else ab[i].xzw="BangZhong";
    }
    sort(ab+1,ab+1+n,cmp2);
    for (int i=1;i<=n;i++){
        cout<<ab[i].na<<" "<<ab[i].xzw<<" "<<ab[i].le<<endl;
    }
    return 0;
}

by hp13307747077 @ 2025-01-01 15:00:25

发错了,是这个

#include<bits/stdc++.h>
using namespace std;
int a[5000];
int main()
{
    int t;
    cin>>t;
    while (t--)
    {
        for (int i=1;i<=1001;i++)
        a[i]=0;
        a[1]=1;
        int n,i,j,k,m;
        int p=1,jw=0;
        scanf("%d%d",&n,&m);
        for(i=2;i<=n;i++)
        {
            jw=0;
            for(j=1;j<=p;j++)
            {
                a[j]=a[j]*i+jw;
                jw=a[j]/10;
                a[j]=a[j]%10;
            }
            while(jw>0)
            {
                a[j]=jw%10;
                jw/=10;
                j++;
            }
            p=j-1;
        }
        long long sum=0;
        for (i=p;i>=1;i--)
        {
            if (a[i]==m)
            sum++;
        }
        cout<<sum<<endl;
    }
    return 0;
}

|