๐Ÿ•ธ Algorithm/๐Ÿ•ธ ๋ฐฑ์ค€ BaekJoon

[๋ฐฑ์ค€][java][2588][๊ณฑ์…ˆ]

๋‰ด์ด NUEY 2023. 8. 27. 20:29
๋ฐ˜์‘ํ˜•

 

 

import java.util.Scanner;

public class Main {
	// 10	2588	๊ณฑ์…ˆ
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int firstInput = scanner.nextInt();
		int secondInput = scanner.nextInt();
		
		scanner.close();
	
		System.out.printf("%d\n", firstInput * (secondInput % 10));
		System.out.printf("%d\n", firstInput * ((secondInput % 100) / 10));
		System.out.printf("%d\n", firstInput * (secondInput / 100));
		System.out.printf("%d", firstInput * secondInput);
	}
}

 

 

 

  • ๋‘๋ฒˆ์งธ๋กœ ์ž…๋ ฅ๋œ ๊ฐ’๋งŒ ์ž˜ ๋‚˜๋ˆ„์–ด firstInput๊ฐ’๊ณผ ๊ณฑํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.
  • 385๋ฅผ 10์œผ๋กœ ๋‚˜๋ˆ„๋ฉด ํ•œ์ž๋ฆฌ์ธ 5๋งŒ ๋‚จ์Šต๋‹ˆ๋‹ค.
  • 385๋ฅผ 100์œผ๋กœ ๋‚˜๋ˆ„๋ฉด 85๊ฐ€ ๋‚จ๋Š”๋ฐ,
    ๋‹ค์‹œ / 10 ๋‚˜๋ˆ„๋ฉด integerํƒ€์ž…์€ 10์ง„์ˆ˜๋งŒ ํ‘œ๊ธฐํ•˜๋Š” ํŠน์„ฑ์ƒ ์†Œ์ˆ˜์ ์€ ์‚ฌ๋ผ์ง€๊ธฐ์— 8๋งŒ ๋‚จ์Šต๋‹ˆ๋‹ค.
  • 385๋ฅผ 100์œผ๋กœ ๋‚˜๋ˆ„๋ฉด 3.85๊ฐ€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ Integerํƒ€์ž…์œผ๋กœ๋Š” 3๋งŒ ๋‚จ๊ฒŒ๋ฉ๋‹ˆ๋‹ค.

 

 

 

 

 

๋ฐ˜์‘ํ˜•