6 solutions

  • 0
    @ 2022-4-8 23:56:30
    import java.util.Scanner;
    
    public class Main {
    	public static void main(String[] args) {
    		Scanner sc = new Scanner(System.in);
    		int n = sc.nextInt();
    		int i = 2;// 用来除的数,检验n是否为质数
    		for(;i<=n;i++) {
    			if(n%i==0) break;
    		}
    		System.out.println(n/i);
    		sc.close();
    	}
    }
    

    Information

    ID
    44
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    7
    Tags
    # Submissions
    968
    Accepted
    234
    Uploaded By