끄적끄적 코딩
article thumbnail
Published 2019. 3. 5. 00:58
[C++] 백준 10430번 나머지 알고리즘

문제에 있는 연산을 그대로 입력하여 출력하였습니다.

 

#include <iostream>
using namespace std;

int main(int argc, char *argv[])
{
   int a, b, c;
   cin >> a;
    cin >> b;
    cin >> c;
    
   cout << (a+b)%c << endl;
    cout << (a%c + b%c)%c << endl;
    cout << (a*b)%c << endl;
    cout << (a%c * b%c)%c  << endl;
   return 0;
}

'알고리즘' 카테고리의 다른 글

[C++] 백준 2741번 N 찍기  (0) 2019.03.05
[C++] 백준 2558번 A+B - 2  (0) 2019.03.05
[C++] 백준 10869번 사칙연산  (0) 2019.03.05
[C++] 백준 1008번 A/B  (0) 2019.03.05
[C++] 백준 10998번 AxB  (0) 2019.03.05

검색 태그