1 条题解

  • 0
    @ 2025-4-7 21:41:57

    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

    信息

    ID
    2087
    时间
    1000ms
    内存
    32MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者