전공공부
[BOJ_19532] 수학은 비대면강의입니다. 본문
별도 설명은 필요하지 않은듯 하여 코드만 남긴다.
package Simulation;
import java.util.Scanner;
public class BOJ_19532 {
public static void main(String[] args) throws Exception{
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int d = sc.nextInt();
int e = sc.nextInt();
int f = sc.nextInt();
for(int x = -999; x <= 999; x++){
for(int y = -999; y <= 999; y++){
if(c == (a*x + b*y) && (d*x + e*y) == f){
System.out.println(x+ " "+ y);
return;
}
}
}
}
}
https://www.acmicpc.net/problem/19532
19532번: 수학은 비대면강의입니다
정수 $a$, $b$, $c$, $d$, $e$, $f$가 공백으로 구분되어 차례대로 주어진다. ($-999 \leq a,b,c,d,e,f \leq 999$) 문제에서 언급한 방정식을 만족하는 $\left(x,y\right)$가 유일하게 존재하고, 이 때 $x$와 $y$가 각각 $-
www.acmicpc.net
'Study > Problem Solving' 카테고리의 다른 글
[BOJ_2075] N번째로 큰 수 (0) | 2023.11.05 |
---|---|
[BOJ_22942] 데이터 체커 (1) | 2023.11.04 |
[BOJ_2231] 분해 합 (1) | 2023.11.02 |
[BOJ_2798] 블랙잭 (1) | 2023.11.01 |
[BOJ_4358] 생태학 (0) | 2023.10.31 |