반응형
https://www.acmicpc.net/problem/18398
18398번: HOMWRK
In one of the beautiful cities of Afghanistan two sisters are going to program a simple game to help them solve their mathematics homework. Their homework asks them to calculate the sum and multiplication of two numbers. Your task is to help them to build
www.acmicpc.net
간단 구현 문제였습니다.
📕 풀이방법
📔 입력 및 초기화
간단 구현 문제였습니다.
📔 풀이과정
test case 수 t, 문제 수 n, 각 문제의 점수 a, b를 선언 후 적절히 입력받습니다.
📔 정답출력
a+b와 a*b값을 형식에 맞춰 출력합니다.
📕 Code
#include <bits/stdc++.h>
using namespace std;
int t, n, a, b;
int main(){
cin >> t;
while(t--){
cin >> n;
while(n--){
cin >> a >> b;
cout << a + b << ' ' << a * b << '\n';
}
}
}
*더 나은 내용을 위한 지적, 조언은 언제나 환영합니다.
'Algorithm > Implementation' 카테고리의 다른 글
(C++, Rust) - 백준(BOJ) 23794 : 골뱅이 찍기 - 정사각형 (0) | 2022.09.05 |
---|---|
(C++) - 백준(BOJ) 11800 : Tawla (0) | 2022.09.04 |
(C++) - 백준(BOJ) 17284 : Vending Machine (0) | 2022.09.02 |
(C++, Rust) - 백준(BOJ) 23803 : 골뱅이 찍기 - ㄴ (0) | 2022.09.01 |
(C++, Python) - 백준(BOJ) 15818 : 오버플로우와 모듈러 (0) | 2022.08.30 |