[Offer收割]编程练习赛39 register

Ended

Participants:163

Verdict:Time Limit Exceeded
Score:40 / 100
Submitted:2017-12-10 13:50:33

Lang:Java

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.util.Scanner;
import java.math.BigInteger;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        Integer n = sc.nextInt();
        int k = sc.nextInt();
        int count = 0;
        Integer up = 1;
       //BigInteger one =BigInteger.ONE;
        while(count < k){
         if(MaxS(n,up== 1) {
             count++;
             up++;
         }
         else
             up++;
        }
        System.out.println(up - 1 );
    }
    private static Integer MaxS(Integer n,Integer i){
       Integer c = n % i;
        while(c != 0){
            n = i;
            i = c;
           // if(i.compareTo(zero) == 0)
               // break;
            c = n %(i);
        }
        return  i;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX