백준 BOJ C# 10430

2020. 1. 8. 20:42백준 알고리즘 단계별/입출력과 사칙연산

반응형

 

출제 링크 : https://www.acmicpc.net/problem/10430

 

10430번: 나머지

첫째 줄에 A, B, C가 순서대로 주어진다. (2 ≤ A, B, C ≤ 10000)

www.acmicpc.net

 

코드

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using System;
using static System.Console;
 
namespace baekjoon
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = ReadLine();
            string[] arr_input = input.Split();
            int a = int.Parse(arr_input[0]);
            int b = int.Parse(arr_input[1]);
            int c = int.Parse(arr_input[2]);
 
            WriteLine((a + b) % c);
            WriteLine((a % c + b % c) % c);
            WriteLine((a * b) % c);
            WriteLine((a % c * b % c) % c);
 
        }
    }
}

* int형으로 각 배열된 string 값을 int로 형변환뒤 계산해 주었다.

반응형