Go: package main

import (
    "os"
    "fmt"
    "bufio"
    "strconv"
)

var sc = bufio.NewScanner(os.Stdin)
func readInt() int64 {
    sc.Scan()
    n, _ := strconv.Atoi(sc.Text())
    return int64(n)
}


func main() {
    var ans int64 = 1
    var n int64 = readInt()
    var i int64
    for i = 1; i <= n; i++ {
        ans *= i
    }
    fmt.Println(ans)
}

C++: 

#include<bits/stdc++.h>
using namespace std;
 
int main(){
    int n;
    long k=1;
    cin>>n;
    int i;
    for(i=1;i<=n;i++){
        k*=(long)i;
    }
    cout<<k<<endl;
    return(0);
}
 

 
Compile Error Logs: 

You are not authorized to see the message. 
 
 
Status 
Judge: 1/1  C++  CPU: 00.00 sec  Memory: 3056 KB  Length: 190 B  2017-03-15 15:43  2017-03-15 15:43  
Results for testcases 
Case # Verdict CPU Time Memory In Out Case Name 
 Case #1: : Accepted  00.00 sec 3056 KB    



 < prev | 1 /  1 | next >      : Accepted        00.00 sec        3056 KB 

 

Judge Input #1 (  | )  Judge Output #1 (  | ) 


  

 

Comments 
 

 Under Construction. 

 
Categories 
 



 
Free Tags

C++: #include <iostream>
using namespace std;

int main()
{
 int n;
 cin >> n;
 long long int ans;
 for(int i=1; i<=n; int i++) ans *= i;

 cout << ans << '\n';

 return 0;
}

C++: #include <iostream>
using namespace std;

unsigned long long factorial(int x) {

  if(x != 1)
    return x * factorial(x-1);
  else if(x == 1)
    return 1;
}

int main() {
  int a;
  cin >> a;
  cout << factorial(a) << endl;
  return 0;
}

C++: #include <iostream>
//#include <fstream.h>
//#include <cstring>
using namespace std;

int factorial(int n) {
  if(n==0) return 1;
  else return n*factorial(n-1);
}

int main() {
  
  int n;

  cin >> n;

  cout << factorial(n);

  return 0;
}

C++: #include <iostream>
using namespace std;

unsigned long long int fact(int n,unsigned long long int s){
	if(n == 0){
		return 1;
	}else if(n == 1){
		return s;
	}else{
		return fact(n-1,n*s);
	}
}

int main(){
	int n;
	cin >> n;
	cout << fact(n,1) << endl;
	return 0;
}

C++: #include<cstdio>
using namespace std;
long long int fact(long long int x){
    if(x == 1) return 1;
    else return fact(x-1) * x;
}
int main(){
    int n;
    scanf("%d",&n);
    printf("%lld\n",fact(n));
    return 0;
}

C++: #include<iostream>
using namespace std;

long long kaijo(long long n);

int main()
{
    long long a;
    cin >> a;
    cout << kaijo(a) << endl;
    return 0;
}

long long kaijo(long long n)
{
    return (n==1) ? 1 : n*kaijo(n-1);
}

C++: #include<cstdio>
#include<iostream>
int main(){
    long long int ans=1;
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        ans*=i;
    printf("%lld\n",ans);
    return 0;
}

C++: #include <stdio.h>
int main()
{
double n, ans = 1;
int i;
scanf("%lf",&n);
for(i=1; i<=n; i++)
ans *= i;
printf("%0.f\n",ans);
return 0;
}

C++: #include<stdio.h>
int main(void)
{
	long long int s;
	int n,i;
	scanf("%d",&n);
	s=1;
	for(i=2;i<=n;i++){
		s=s*i;
	}
	printf("%d\n",s);
	return 0;
}

C++: #include<stdio.h>
#include <string>
#include <iostream>
using namespace std;


int factorial_loop(long long n);

int main(void)
{
long long n;
long long result1;


cin>>n;

if(0<n&&n<21) ;
else return 0;

	result1 =factorial_loop(n);

//	cout<<(long long)result1<<endl;
	return 0;

}
int factorial_loop(long long n) {
    long long result = 1;
    long long k;

    for(k = 1; k <= n; k++) {
        result *= k;
		//
    }
	cout<<result<<endl;
    return result;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, ll> PS;
typedef vector<ll> V;

long long n, ans = 1;

int main(){
	cin >> n;
	FOR(i, 1, n+1)ans *= i;
	cout << ans << endl;
}

C++: #include<stdio.h>

long long int kaijo(long long int);


int main()
{
	long long int n;
	scanf("%lld", &n);
	printf("%lld\n", kaijo(n));
}

long long int kaijo(long long int n)
{
	if (n == 0)return 1;
	return n*kaijo(n - 1);
}

C++: #include<iostream>
#include<cstdio>
#include<string>

using namespace std;

int main(){
	long long int ans;
	int n;
	ans=1;

	cin >> n;
	for(int i=1;i<=n;i++)
		ans *=i;
	cout<<ans<<endl;

}

C++: #include <stdio.h>

int main(){

	int a=0, r=0;

	scanf("%d",&a);

	r = a;

	for(int i=a-1; i>0; i--){
		r = r * i;
	}

	printf("%d\n", r);
}

C++: #include<stdio.h>

int main(void)
{
	unsigned long long int kai=1;
	int n,i,x=0;
	scanf("%d",&n);
	for(i=1;i<n+1;i++)
	{
		 kai=kai*i;

		 while(kai % 10 ==0)
		 {
			 kai = kai / 10;
			 x+=1;
		 }
	}
	if(x==0){
	printf("%d\n",kai);
	}
	else
	{
		printf("%d",kai);
		for(i=0;i<x;i++)
		{
			printf("%d",0);
		}
		printf("\n");
	}
  return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int i,n,a;
	cin>>n;
	a=1;
	for(i=n;i>=1;i--)
	{
	a=a*i;	
	}
cout<<a<<endl;
	return 0;
}

C++: #include <stdio.h>

int
main(void)
{
	char line[80];
	int n;

	if (fgets(line, sizeof line, stdin)) {
		if (sscanf(line, "%d", &n) == 1) {

			int r = 1;
			for (int i = 2; i <= n; i++) {
				r *= i;
			}
			
			printf("%d\n", r);
		}
	}

	return 0;
}

C++: #include<bits/stdc++.h>

using namespace std;

main(){
	int a;
	cin >> a;
	int b=0;
	long long c=a;
	int d=a;
	long long s=1;
	while(a > b+1){
		b=b+1;
		s=c*s;
		c=c-1;
	}
	printf("%lld\n",s);
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k=1;
  cin >> n;
  for(int i = 2;i <= n;i++) k*=i;
  cout << k << endl;
  return 0;
}

C++: #include<iostream>
int main(){
	int n;
	std::cin>>n;
	int a=1;
	for(int i=1;i<=n;i++){
		a*=i;
	}
	std::cout<<a<<std::endl;
	return 0;
}

C++: #include <iostream> 
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	int n,ans=1;
	cin>>n;
	for(int i=1;i<=n;i++){
		ans*=i;
	}
	cout<<ans<<endl;
    return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int f(int n){
	if(n==1) return 1;
	return n*f(n-1);
}

int main(){
	int n;
	while(cin>>n){
		cout<<f(n)<<endl;
	}
	return 0;
}

C++: #include <iostream>
typedef unsigned long long ULL;
ULL factorial(ULL n)
{
    if (n == 0) {
        return 1;
    } 
    else {
        return n * factorial(n-1);
    }
}
int main()
{
    ULL n;
    std::cin  >> n;
    std::cout << factorial(n) << std::endl;
}

C++: #include<stdio.h>
int main ()
{
int i,n;
scanf("%d",&n);
i=n-1;
while (i>0)
{
n=n*i;
i--;
}
printf("%d",n);
return 0;
}

C++: #include<string>
#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
	int n;
	int ans = 0;
	cin >> n;
	if (n)ans++;
	for (int i = 1; i <= n; i++)
	{
		ans *= i;
	}
	cout << ans<<endl;
}

C++: main(){printf("%d\n",120);return 0;}

C++: #include <iostream>
using namespace std;
long long f(int n){
	return (n == 0 ? 1 : n * f(n-1));
}
int main(){
	int n;
	cin >> n;
	cout << f(n) << endl;
}

C++: #include<iostream>
using namespace std;
int main() {
cin>>n;
int ans = 1;
for(int i=1; i<=n; i++) ans *= i;
cout<<ans<<endl;
}

C++: #include <iostream>
#include <stdio.h>
using namespace std;
int main(){
    int n;
    double x=1;
    cin >> n;
    for (int i=1;i<=n;i++){
        x*=i ;
    }
    // cout << x << endl;
    printf("%.0g",x);
}

C++: #include <iostream>

using namespace std;

int main() {
    long long int n, res;

    res = 1;

    cin >> n;

    for (int i = 1; i <= n; i++) {
        res *= i;
    }

    cout << res << endl;

    return 0;
}