Floating-point exception?
查看原帖
Floating-point exception?
1274934
tangjy2012楼主2024/8/28 15:30
#include<bits/stdc++.h>
using namespace std;
int jiecheng(int x){
    int ans=0;
    for(int i=1;i<=x;i++){
        ans*=i;
    }
    return ans;
}
int main(){
    int t,k;
    cin>>t>>k;
    while(t--){
        int n,m,num,ans=0;
        cin>>n>>m;
        for(int i=0;i<n;i++){
            for(int j=0;j<min(i,m);j++){
                num=int(jiecheng(i)/(jiecheng(i)*jiecheng(i-j)));
                if(num%k==0){
                    ans++;
                }
            }
        }
        cout<<ans;
    }
    return 0;
}

只有5分,剩下RE,求调

记录

2024/8/28 15:30
加载中...