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.|

RGB7312 - Тооны факториал

Өгөгдсөн тоо ямар нэгэн тооны факториал бол тэр тоог хэвлэ. Үгүй бол No гэж хэвлэ.

Input

Бүхэл тоо өгөгдөнө.

Output

Өгөгдсөн тоо ямар нэгэн тооны факториал бол тэр тоог үгүй бол No.

Example

Input 1:
24

Output 1:
4
Input 2:
10
Output 2:
No
Input 2:
1 Output 2: 1


Нэмсэн:Bataa
Огноо:2013-01-11
Хугацааны хязгаарлалт: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
2020-12-08 12:37:38
easy peasy xD
#include <iostream>
#include <cmath>

using namespace std;

int main(){
int num, counter = 2;
cin >> num;

if(num == 0 || num == 1) {
cout << 1;
return 0;
}
while(num % counter == 0 && sqrt(num) > counter){
num /= counter;
counter ++;
}

if(num == counter) cout << counter << endl;
else cout << "No" << endl;


return 0;
}
2020-11-14 05:09:37
Thank me later
Thank me later
#include <iostream>
#include <math.h>

using namespace std;

int main() {

int n, s = 1, i = 0;

cin >> n;

if ( n == 1 ) {
cout << 1;
} else {

while( n > s ) {
i++;
s = s * i;
}
if ( n == s) {
cout << i;
} else{
cout <<"No";
}
}
return 0;
}

2020-10-11 05:09:56
#include <cstdio>
int main(){
int a,i=1;
scanf("%d", &a);
while(a%i==0){
a=a/i;
i++;
}
if(a==1) printf("%d", i-1);
else printf("No");
return 0;
}
2 ez
2020-10-10 17:37:33
#include <stdio.h>

int main()
{
int a,sum = 1;
scanf("%d",&a);
for(int i = 1; i < a; i ++)
{
sum = sum * i;
if(sum == a)
{
printf("%d",i);break;
}
}
if(sum != a)
printf("NO");
} buruu genu ?
2020-08-28 10:47:15
*_*

Last edit: 2020-08-28 10:48:42
2020-07-30 07:52:01
факториал тоо гэж ямар тоо байдын
2020-07-17 16:57:57
import java.util.Scanner;

//Java program to remove punctuation from a given string

//Java code to illustrate different constructors and methods
//String class.

//Java program to demonstrate
//codePoints() method of IntStream class

import java.util.stream.IntStream;

public class GFG {
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k=n;
for(int i=1;;i++) {
if(n%i==0) {
n=n/i;
}
else
break;
}
if(n==1) {
System.out.println(k);
}else
System.out.println("NO");


}
}
2020-07-17 15:02:29
import java.util.*;
import java.lang.*;

class Main
{
public static void main (String[] args) throws java.lang.Exception
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 1;; i++) {
if (n % i == 0) {
n /= i;
} else {
break;
}
}
if (n == 1)
System.out.println("YES");
else
System.out.println("NO");

}
}
}
2020-05-19 17:27:38
#include <stdio.h>

int main(int argc, char** argv) {
int n, x, l, k=1;
scanf("%d", &n);
l=n/2;
for(int m=1;m<l;m++){
k=k*m;
x=m;
if(k==n){
printf("%d", x);
return 0;

}
}
printf("NO");


}bruu genuu ?????
2020-03-25 01:32:44
Bilgee
#include <stdio.h>
int main()
{
int s=1, n, m, i;
scanf("%d",&n);
for ( i=1;; i++){
s=s*i;
m=i;
if (s==n){ printf ("%d\n", m);
return 0;
} else if (s>n) {printf("No\n");
break;
}
}
}
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.