๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Algorithm/๋ฐฑ์ค€ ์•Œ๊ณ ๋ฆฌ์ฆ˜

[๋ฐฑ์ค€ ์•Œ๊ณ ๋ฆฌ์ฆ˜] 2588๋ฒˆ - ๊ณฑ์…ˆ

by ์ฝ”๋”ฉํ•˜๋Š” ๋ถ•์–ด 2021. 1. 30.
๋ฐ˜์‘ํ˜•

1. ์ž…์ถœ๋ ฅ๊ณผ ์‚ฌ์น™์—ฐ์‚ฐ - ๊ณฑ์…ˆ

 

 

๋ฌธ์ œ) (์„ธ ์ž๋ฆฌ ์ˆ˜) × (์„ธ ์ž๋ฆฌ ์ˆ˜)๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ณผ์ •์„ ํ†ตํ•˜์—ฌ ์ด๋ฃจ์–ด์ง„๋‹ค.

(1)๊ณผ (2)์œ„์น˜์— ๋“ค์–ด๊ฐˆ ์„ธ ์ž๋ฆฌ ์ž์—ฐ์ˆ˜๊ฐ€ ์ฃผ์–ด์งˆ ๋•Œ (3), (4), (5), (6)์œ„์น˜์— ๋“ค์–ด๊ฐˆ ๊ฐ’์„ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

์ž…๋ ฅ ์ถœ๋ ฅ
472
385
2360
3776
1416
181720

 

import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int a, b;
		a = sc.nextInt();
		b = sc.nextInt();
		System.out.println(a * (b % 10));
		System.out.println(a * ((b / 10) % 10));
		System.out.println(a * ((b / 100) % 10));
		System.out.println(a * b);
	}
}

a๋ฅผ ๊ธฐ์ค€์œผ๋กœ b์˜ ์ผ์˜ ์ž๋ฆฌ, ์‹ญ์˜ ์ž๋ฆฌ, ๋ฐฑ์˜ ์ž๋ฆฌ๋ฅผ ๊ณฑํ•œ๋‹ค... ์ด๋Ÿฐ ์‹์œผ๋กœ ํ‘ผ๋‹ค

์–ด๋ ต๋‹ค

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€