Skip to content

Commit 6804cb8

Browse files
committed
백준 10869번 사칙연산
문제 링크: https://www.acmicpc.net/problem/10869
1 parent 8f218c6 commit 6804cb8

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

백준 10869번 사칙연산/main.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
def solve():
2+
a, b = input().split(' ')
3+
a, b = int(a), int(b)
4+
print(a + b)
5+
print(a - b)
6+
print(a * b)
7+
print(a // b)
8+
print(a % b)
9+
10+
if __name__ == '__main__':
11+
solve()
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7 3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
10
2+
4
3+
21
4+
2
5+
1
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import sys
2+
from pathlib import Path
3+
from unittest import TestCase
4+
from main import solve
5+
6+
def my_solve(testcase_input):
7+
sys.stdin = open(testcase_input, 'r')
8+
stdout = sys.stdout
9+
sys.stdout = open('stdout.txt', 'w')
10+
solve()
11+
sys.stdout.close()
12+
sys.stdout = stdout
13+
14+
class Test(TestCase):
15+
def test1_solve(self):
16+
my_solve('test1.txt')
17+
self.assertEqual(
18+
Path('test1_answer.txt').read_text().strip(),
19+
Path('stdout.txt').read_text().strip())
20+
21+
class Test(TestCase):
22+
def test1_solve(self):
23+
my_solve('test1.txt')
24+
self.assertEqual(
25+
Path('test1_answer.txt').read_text().strip(),
26+
Path('stdout.txt').read_text().strip())

0 commit comments

Comments
 (0)