1 solutions

  • 0
    @ 2025-11-5 19:55:14

    C :

    #include<stdio.h>
    #include<math.h>
    
    int main()
    {
    	int n;
    	while(scanf("%d",&n)!=EOF)
    		printf("%d\n",(int)pow(10,n*log10(n)-(int)(n*log10(n))));
    	return 0;
    }
    

    C++ :

    #include<stdio.h>
    #include<math.h>
    
    int main()
    {
    	int n;
    	while(scanf("%d",&n)!=EOF)
    		printf("%d\n",(int)pow(10,n*log10(n)-(int)(n*log10(n))));
    	return 0;
    }
    

    Java :

    public class Main {
                public static void main(String[] args) { 
                  java.util.Scanner input = new java.util.Scanner(System.in) ;
                  while(input.hasNextInt()){
                      int n =input.nextInt();
                      double x = n*Math.log10(n);
                      double m = x-(int)x;
                      int m1=(int)Math.pow(10,m);
                      System.out.println(m1);
                    }
                }
            }
    

    Python :

    from math import *
    
    while True:
        try:
            n = int(raw_input())
            print int(modf(10**(modf(n*log10(n))[0]))[1])
        except:
            break
    
    
    • 1

    Information

    ID
    19826
    Time
    1000ms
    Memory
    32MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By