Algorithmus

C# 10430 분배법칙

최승길 2021. 10. 25. 10:19

https://www.acmicpc.net/problem/10430

 

using System;
using System.Threading;
using System.Collections.Generic;

namespace NetHappy
{
    class Program
    {
        static void Main(string[] args)
        {
            string str;
            str = Console.ReadLine();
            string[] result = str.Split(new char[] { ' ' });
            double a = (double)Convert.ToInt32(result[0]);
            double b = (double)Convert.ToInt32(result[1]);
            double c = (double)Convert.ToInt32(result[2]);

            Console.WriteLine((a + b) % c);
            Console.WriteLine(((a % c) + (b % c)) % c);
            Console.WriteLine((a * b) % c);
            Console.WriteLine(((a % c) * (b % c)) % c);
        }
    }
}