[JAVA][Baekjoon] 21568번 Ax+By=C 🌟🌟
·
Baekjoon
import java.io.*;import java.util.ArrayList;import java.util.Scanner;import java.util.StringTokenizer;public class Main { public static void main(String []args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); StringTokenizer st = new StringTokenizer(b..
[JAVA][Baekjoon] 1850번 최대공약수 🌟🌟
·
Baekjoon
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"); ..
[JAVA][Baekjoon] 1934번 최소공배수 🌟🌟
·
Baekjoon
import java.io.*;import java.util.Scanner;public class Main { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int i = 0; i
[JAVA][Baekjoon] 11689번 GCD(n, k) = 1 🌟🌟
·
Baekjoon
import java.io.*;import java.util.Scanner;public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); long n = Long.parseLong(br.readLine()); long result = n; for(long p = 2; p1) result = result - result/n; System.out.println(result); }}