求救!除了暴力还有什么办法(除1其他TLE)
查看原帖
求救!除了暴力还有什么办法(除1其他TLE)
990781
pppppLF楼主2023/5/1 09:35

奉上代码:

#include<bits/stdc++.h>
using namespace std;

int main(){
    int n,z;
    long long sum=1;
    cin>>n;
    for(int i=1;i<=n;i++){
    	sum*=i;
	}
	for(int i=1;;i++){
		z=sum%10;
		if(z!=0){
			cout<<z;
			break;
		}else{
			sum/=10;
		}
	}
	return 0;
}

其他疑惑

其他疑惑2

2023/5/1 09:35
加载中...