[Baekjoon / JAVA] Baekjoon Algorithm 1001 A - B
[Baekjoon / JAVA] Baekjoon Algorithm 1001 A - B
Write a program that reads two integers A and B, then prints A - B.
@RWBwritten at 2021-05-21 12:51:19
| Rank | Language Used |
|---|---|
🖼️ JAVA |
| Time Limit | Memory Limit |
|---|---|
| 2 sec | 128MB |
Write a program that reads two integers A and B, then prints A - B.
The first line gives A and B.
Print A - B on the first line.
- Input
TC
3 2
- Output
TC
1
This is a subtraction algorithm, only differing from problem 1000 in the operation used. Read two numbers with Scanner, subtract them, and print the result.
JAVA
import java.util.Scanner; /** * Baekjoon Problem 1001 algorithm class * * @author RWB * @see <a href="https://blog.itcode.dev/posts/2021/05/21/a1001">1001 solution</a> * @since 2021.04.21 Wed 21:51:19 */ public class Main { /** * Main function * * @param args: [String[]] parameters */ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int a = scanner.nextInt(); int b = scanner.nextInt(); scanner.close(); System.out.println(a - b); } }
- Math
- Implementation
- Arithmetic Operations
# Baekjoon# Algorithm# JAVA# Arithmetic Operations# BRONZE# BRONZE V
