문제 설명

Untitled

Untitled

문제 분석

Untitled

Untitled

슈도코드

Untitled

구현

public class 최대_공약수_1850 {
    public static void main(String[] args) throws IOException {
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
        Scanner scan = new Scanner(System.in);
        long a = scan.nextLong();
        long b = scan.nextLong();
        long result = gcd(a, b);
        for (int i = 0; i < result; i++) {
            writer.write("1");
        }
        writer.flush();
        writer.close();
    }

    private static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        } else {
            return gcd(b, a % b);
        }
    }
}