1 条题解

  • 0
    @ 2025-10-10 15:45:59

    C :

    #include <stdio.h>
    #include <stdlib.h>
    int main()
    {
    	printf("5\n");
    	return 0;
    }
    //Author: ITProgrammer
    

    C++ :

    #include<bits/stdc++.h> 
    using namespace std; 
    
    int main(){ 
    	int i = 5;
    	long long s = 0;
    	int c = 0;
    	while(1==1){
    		s=pow(2,pow(2,i));
    		for(int j = 2;j <= sqrt(s);j++){
    			if(s % j == 0){
    				c++;
    				break;
    			}
    		}
    		if(c != 0){
    			cout<<i;
    			break;	
    		}
    		i++;
    	}
    	return 0;
    } 
    

    Java :

    import java.util.*;
    public class Main{
    	public static void main(String[] args){
    		int i = 5;
    		double x;
    		int c = 0;
    		while(1==1){
    			x = Math.pow(2,Math.pow(2,i));
    			for(int j = 2;j <= Math.sqrt(x);j++){
    				if(x % j == 0){
    					c++;
    					break;
    				}
    			}
    			if(c != 0){
    
    				break;
    			}
    		}
    		System.out.println(i);
    		
    	}
    }
    

    Python :

    import math
    import sys
    # x,y=list(map(int,input().split()))
    # n=int(input())
    def zs(n):
        if n==1:
            return 0
        elif n==2:
            return 1
        else:
            for i in range(2,int(n**0.5)+1):
                if n%i ==0:
                    return 0
            return 1
    def hs(i):
        return pow(2,pow(2,i))+1
    i=0
    while zs(hs(i))==1:
        i=i+1
    print(i)
    
    
    • 1

    信息

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