题解 | #Digit Sum of N!#

Digit Sum of N!

https://ac.nowcoder.com/acm/problem/15861

#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int main() {
 int n;
 while(cin>>n){
  if(n==1){
   cout<<1<<endl;
  }
  else if(n==2){
   cout<<2<<endl;
  }
  else if(n==3||n==4){
   cout<<6<<endl;
  }
  else if(n==5){
   cout<<3<<endl;
  }
  else{
   cout<<9<<endl;
  }
 }
}

alt

全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务