λ°μν
μ½λ
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int T = scan.nextInt();
for(int tc=1; tc<=T; tc++) {
int n = scan.nextInt(); // λΏ κ°μ
int m = scan.nextInt(); // μ§μΉ λ§λ¦¬μ
int x = (2*m)-n; // μ λμ½μ μ
int y = n-m; // νΈμνΌμ μ
System.out.println("#" + tc + " " + x + " " + y);
}
scan.close();
}
}
νμ΄
μ°λ¦½λ°©μ μμ ν΅ν΄ ν΄κ²°νλ©΄ κ°λ¨νλ€.
μ λμ½μ λΏμ κ°μ = 1κ° , νΈμνΌμ λΏμ κ°μ = 2κ°.
λ λλ¬Όμ λΏμ κ°μμ ν© = n
λ λλ¬Όμ λ§λ¦¬ μ = m
λ°λΌμ μ λμ½ = x, νΈμνΌ = yλΌκ³ νμλ,,,
x + y = m
x + 2y = n
μ μ°λ¦½λ°©μ μμ΄ λμ€κ³ , μ μμ x, yμ λν΄ λ¨κΈ°λ©΄
x = (2*m) - n
y = n-m
μ΄λΌλ μμ΄ λμ¨λ€.
λ°μν
'Algorithm' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[SW Expert Academy] - (D3)5948. μμμ΄μ 7-3-5 κ²μ (0) | 2020.06.02 |
---|---|
[SW Expert Academy] - (D3)1493. μμ μλ‘μ΄ μ°μ° (0) | 2020.06.01 |
[SW Expert Academy] - (D3)5515. 2016λ μμΌ λ§μΆκΈ° (0) | 2020.05.27 |
[SW Expert Academy] - (D3)8500. κ·Ήμ₯ μ’μ (0) | 2020.05.26 |
[SW Expert Academy] - (D3)9317. μμ°¬μ΄μ λ°μμ°κΈ° (0) | 2020.05.25 |
λκΈ