728x90
320x100
import java.io.*;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
long a = sc.nextLong();
long b = sc.nextLong();
long result = gcd(a, b);
while(result>0) {
bw.write("1");
result --;
}
bw.flush();
bw.close();
}
public static long gcd(long a, long b){
if(b==0) return a;
else return gcd(b, a % b);
}
}
728x90
반응형
'Baekjoon' 카테고리의 다른 글
[JAVA][Baekjoon] 21568번 Ax+By=C 🌟🌟 (0) | 2025.01.14 |
---|---|
[JAVA][Baekjoon] 1934번 최소공배수 🌟🌟 (0) | 2025.01.11 |
[JAVA][Baekjoon] 11689번 GCD(n, k) = 1 🌟🌟 (0) | 2025.01.11 |
[JAVA][Baekjoon] 1016번 제곱 ㄴㄴ 수 🌟🌟🌟🌟 (0) | 2025.01.10 |
[JAVA][Baekjoon] 1747번 소수&팰린드롬 🌟🌟 (0) | 2025.01.10 |