5 solutions

  • 0
    @ 2025-12-28 8:54:22
    #include<bits/stdc++.h>
    using namespace std;
    int T,n;
    int main() {
    	ios::sync_with_stdio(false);
    	cin.tie(0);
    	cout.tie(0);
    	cin>>T;
    	while (T--) {
    		cin>>n;
    		if (n>=34) {
    			cout<<"0\n";
    		} else {
    			long long sum=1;
    			for (int i=1;i<=n;i++){
    				sum=sum*i%(1ll<<32);
    			}
    			cout<<sum<<"\n";
    		}
    	}
    	return 0;
    }
    

    Information

    ID
    57
    Time
    2000ms
    Memory
    512MiB
    Difficulty
    5
    Tags
    (None)
    # Submissions
    60
    Accepted
    23
    Uploaded By