<문제>
https://www.acmicpc.net/problem/12790
12790번: Mini Fantasy War
넥슨지티에서는 최근 SRPG "슈퍼 판타지 워"의 후속작으로 "미니 판타지 워"를 출시하였다. 전편과 마찬가지로, 미니 판타지 워에서도 각 캐릭터의 전투력을 계산하여야 한다. 각 캐릭터의 전투력
www.acmicpc.net
<풀이>
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
int test, i, hp,mp,atc,def,a,b,c,d,output;
scanf("%d", &test);
while (test--) {
scanf("%d %d %d %d %d %d %d %d", &hp, &mp, &atc, &def, &a, &b, &c, &d);
hp += a;
mp += b;
atc += c;
def += d;
if (hp < 1) hp = 1;
if (mp < 1) mp = 1;
if (atc < 0) atc = 0;
output = hp + 5 * mp + 2 * atc + 2 * def;
printf("%d\n", output);
}
}
--> 변수 설정만 하면되는 아주 간단한 문제
'⌨️ Algorithm > C' 카테고리의 다른 글
1/14 [C] 백준 1152번 - 단어의 개수 (0) | 2022.01.24 |
---|---|
1/14 [C] 백준 1924번 - 2007년 (0) | 2022.01.24 |
1/10 [C] 백준 5426번 - 비밀 편지 (0) | 2022.01.24 |
1/7 [C언어] 백준 23292번 - 코딩 바이오리듬 (0) | 2022.01.07 |
1/6 [C] 백준 3076번 - 상근이의 체스판 (0) | 2022.01.06 |
댓글