문제 링크입니다: https://www.acmicpc.net/problem/8932
8932번: 7종 경기
민혁이는 한국에서 열리는 7종 경기 대회에 참가한다. 7종 경기는 육상의 필드 경기와 트랙 경기 7 종목으로 이루어져 있다. (100미터 허들, 높이뛰기, 포환던지기, 200미터 달리기, 멀리뛰기, 창던
www.acmicpc.net
간단한 구현 문제였습니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
const int MAX = 7; | |
typedef struct | |
{ | |
double A, B, C; | |
} Score; | |
Score score[MAX] = { | |
{9.23076, 26.7, 1.835}, | |
{1.84523, 75, 1.348}, | |
{56.0211, 1.5, 1.05}, | |
{4.99087, 42.5, 1.81}, | |
{0.188807, 210, 1.41}, | |
{15.9803, 3.8, 1.04}, | |
{0.11193, 254, 1.88} | |
}; | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
int T; | |
cin >> T; | |
for (int t = 0; t < T; t++) | |
{ | |
int result = 0; | |
for (int i = 0; i < MAX; i++) | |
{ | |
double P; | |
cin >> P; | |
if (score[i].B >= P) | |
{ | |
result += floor((score[i].A * pow(score[i].B - P, score[i].C))); | |
} | |
else | |
{ | |
result += floor((score[i].A * pow(P - score[i].B, score[i].C))); | |
} | |
} | |
cout << result << "\n"; | |
} | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 9094번 수학적 호기심 (0) | 2021.06.28 |
---|---|
백준 9085번 더하기 (0) | 2021.06.28 |
백준 8815번 Test (0) | 2021.06.28 |
백준 8806번 Papier kamień nożyczki (0) | 2021.06.27 |
백준 8725번 Szachy (0) | 2021.06.27 |