Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

RGB7217 - Давхар факториал

n!! - ыг ол. n тоо тэгш бол n хүртэлх тэгш тоонуудын үржвэр. n тоо сондгой бол n хүртэлх сондгой тоонуудын үржвэр. n=6 үед 2*4*6=48, n=7 үед 1*3*5*7=105

Input

Натурал тоо өгөгдөнө.

Output

Давхар факториал.

Example

Input:
6

Output:
48

Нэмсэн:Bataa
Огноо:2013-01-21
Хугацааны хязгаарлалт:1s
Эх кодын хэмжээний хязгаарлалт:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Програмчлалын хэлүүд:ADA95 ASM32 BASH BF C NCSHARP CSHARP C++ 4.3.2 CPP C99 CLPS LISP sbcl LISP clisp D ERL FORTRAN HASK ICON ICK JAVA JS-RHINO JULIA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON PYPY3 PYTHON3 RUBY SCALA SCM guile ST TCL WHITESPACE

hide comments
2024-01-03 12:25:56
import java.util.*;
import java.lang.*;

class Main
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner in = new Scanner(System.in);
int a = in.nextInt();
int r=1;
int i=1;
if(a%2==0){
while(i<=a){
if(i%2==0){
r=r*i;
}
i++;
}
}else if(a%2==1){
while(i<=a){
if(i%2==1){
r=r*i;
}
i++;
}
}
System.out.println(r);
}
}
2023-11-20 07:46:44
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n;
int s = 1;
cin>>n;
int d = n%2 == 0 ? 2 : 1;
for(int i=d; i<=n; i+=2)
{
s *= i;
}
cout<<s;
return 0;
}
2023-07-02 14:33:46
https://www.youtube.com/watch?v=j5a0jTc9S10&t=4s

End ihenhi bodlogiin bodolt tavisan baigaa shuu orod like darad uzeerei amjilt <3 <3
2023-07-02 13:34:42
#include <bits/stdc++.h>
using namespace std;

int main() {



long long a[1000],b=1,n,i,r,e,c,s=1,d=-132423;
cin>>n;

for(i=1; i<=n; i++){
if(i%2==0)
s*=i;
else
b*=i;


}
if(n%2==0)
cout<<s;
else
cout<<b;
return 0;
}
AHLAH DESLEGCH LHAMJAM G.TAMIR OD GEDEG NERTEI TSAGDAA NARTAI TAARVAL ZUGTAARAI BOLGOOMJTOI BAIGAARAI MEDREL MUUTAI BAS AYULTAI SHUU!!!!!!!!!!!!!!!!!
AHLAH DESLEGCH LHAMJAM G.TAMIR OD GEDEG NERTEI TSAGDAA NARTAI TAARVAL ZUGTAARAI BOLGOOMJTOI BAIGAARAI MEDREL MUUTAI BAS AYULTAI SHUU!!!!!!!!!!!!!!!!!
AHLAH DESLEGCH LHAMJAM G.TAMIR OD GEDEG NERTEI TSAGDAA NARTAI TAARVAL ZUGTAARAI BOLGOOMJTOI BAIGAARAI MEDREL MUUTAI BAS AYULTAI SHUU!!!!!!!!!!!!!!!!!
AHLAH DESLEGCH LHAMJAM G.TAMIR OD GEDEG NERTEI TSAGDAA NARTAI TAARVAL ZUGTAARAI BOLGOOMJTOI BAIGAARAI MEDREL MUUTAI BAS AYULTAI SHUU!!!!!!!!!!!!!!!!!
AHLAH DESLEGCH LHAMJAM G.TAMIR OD GEDEG NERTEI TSAGDAA NARTAI TAARVAL ZUGTAARAI BOLGOOMJTOI BAIGAARAI MEDREL MUUTAI BAS AYULTAI SHUU!!!!!!!!!!!!!!!!!
2022-10-27 07:34:24
#include<bits/stdc++.h>
using namespace std;
int main (){
int a, s=1, i,b;
cin>>a;
if (a%2==0){
for(i=2;i<=a;i=i+2)
s=s*i;
}
else{
for(i=1;i<=a;i=i+2)
s=s*i;
}
cout<<s<<endl;
}
2022-10-25 15:05:08
#include<stdio.h>
main(){
int a,b=1,s=1;
scanf("%d",&a);
if(a%2==0){

for(int i=1;i<=a;i++){
if(i%2==0){
b=b*i;
}
}

}

else{
for(int i=1;i<=a;i++){
if(i%2==!0){
s=s*i;


}

}

}
if(a%2==0) printf("%d",b);
else
printf("%d",s);
}
2022-09-22 07:37:53
Scanner scan = new Scanner (System.in);
System.out.print("A=");
int nu1 = scan.nextInt();
int n1=1,n2=1;
for(int a=1;a<=nu1;a++)
{
if(nu1%2==1)
{
if(a%2==1)
{
n1*=a;
}
}
else
{
if(a%2==0)
{
n2*=a;
}}
}if(nu1%2==1)
System.out.print(n1);
if(nu1%2==0) {
System.out.print(n2);
2022-06-30 11:49:01
ez
2022-05-26 02:01:44
ez
2022-05-26 02:01:44
ez
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.