- ganggang的烦恼
- 2016-07-16 10:30:44 @
#include<iostream>
#include<math.h>
using namespace std;
int n,m=1;
bool prime(long y){
long x=sqrt(y)+1;
if(y==1||y==2||y==3)return true;
if(y%2==0||y%3==0)return false;
for(int i=5;i<=x;i+=2)
if(y%i==0)return false;
return true;
}
int main(){
int i,y=0,a=0;
cin>>n;
for(i=n;i>0;i--){
m=m*i;
}
//cout<<m<<endl;
do{
a=m%10;
y+=a;
m=m/10;
}while(m);
cout<<y;
if(prime( y)==true)
cout<<"T";
if(prime( y)==false) cout<<"F";
return 0;
}
3 条评论
-
贱人在我右边 LV 9 @ 2016-12-07 12:46:38
哦吼吼吼
-
2016-07-21 15:56:03@
![](c:)
-
2016-07-20 13:42:21@
需要高精度
- 1