Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- dfs
- Unity
- 백준
- 기초
- DP
- Algorithm
- python
- w3school
- 문제풀이
- 재귀
- dynamic
- Tutorial
- 프로그래밍
- Programming
- W3Schools
- C#
- github
- Unreal Engine 5
- c++
- Basic
- guide
- 파이썬
- 오류
- Class
- String
- 시작해요 언리얼 2022
- UE5
- loop
- parameter
- Material
Archives
- Today
- Total
행복한 개구리
(Python/C#/C++) 백준 10430번 - 나머지 본문
Python
A, B, C = map(int, input().split())
result = [(A+B)%C, ((A%C)+(B%C))%C, (A*B)%C, ((A%C)*(B%C))%C]
for i in result:
print(i)
C#
using System.Collections;
string line = Console.ReadLine();
string[] nums = line.Split(" ");
int A, B, C;
A = int.Parse(nums[0]);
B = int.Parse(nums[1]);
C = int.Parse(nums[2]);
int[] result = new int[4] { (A + B) % C, ((A % C) + (B % C)) % C, (A * B) % C, ((A % C) * (B % C)) % C };
for (int i = 0; i < result.Length; i++)
{
Console.WriteLine(result[i]);
}
string으로 입력받아 이것을 배열로 변환합니다.
배열의 요소를 각 A, B, C에 int로 형변환하여 할당합니다.
C++
#include <iostream>
using namespace std;
int main() {
int A, B, C;
cin >> A >> B >> C;
int results[4] = {(A + B) % C, ((A % C) + (B % C)) % C, (A * B) % C, ((A % C) * (B % C)) % C};
for (int i = 0; i < 4; i++) {
cout << results[i] << "\n";
}
}
'Algorithm > BaekJoon' 카테고리의 다른 글
(Python/C#/C++) 백준 25083번 - 새싹 (0) | 2022.07.13 |
---|---|
(Python/C#/C++) 백준 2588번 - 곱셈 (0) | 2022.07.11 |
(Python/C#/C++) 백준 18108번 - 1998년생인 내가 태국에서는 2541년생?! (0) | 2022.07.11 |
(Python/C#/C++) 백준 10926번 - ??! (0) | 2022.07.11 |
(Python/C#/C++) 백준 10869번 - 사칙연산 (0) | 2022.07.08 |