728x90
10869번 - 사칙연산 ( www.acmicpc.net/problem/10869 )
#include <stdio.h>
int main() {
int a, b;
scanf("%d %d", &a, &b);
printf("%d\n%d\n%d\n%d\n%d", a + b, a - b, a * b, a / b, a % b);
}
#include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
cout << a + b << "\n" << a - b << "\n" << a * b << "\n" << a / b << "\n" << a % b;
}
10430번 - 나머지 ( www.acmicpc.net/problem/10430 )
#include <stdio.h>
int main() {
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
printf("%d\n%d\n%d\n%d", (a + b) % c, ((a % c) + (b % c)) % c, (a * b) % c, ((a % c) * (b % c) % c));
}
#include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << (a + b) % c << "\n" << ((a % c) + (b % c)) % c << "\n" << (a * b) % c << "\n" << ((a % c) * (b % c) % c);
}
728x90
반응형
'개인공부 > Baekjoon Online Judge' 카테고리의 다른 글
[C++] 1330번 (0) | 2021.04.29 |
---|---|
[C++] 2588번 (0) | 2021.04.29 |
[C++] 1008번 (0) | 2021.04.28 |
[C++] 1000번 / 1001번 / 10998번 (0) | 2021.04.28 |
[C++] 10172번 (0) | 2021.04.28 |