반응형
https://www.acmicpc.net/problem/24751
24751번: Betting
For each option (option one, then option two), display the number x such that 1:x is the switch-payout-ratio for that option. Your answer should have an absolute or relative error of at most $10^{-3}$.
www.acmicpc.net
간단한 소수점 출력문제였습니다.
📕 풀이방법
📔 입력 및 초기화
optionOne을 선언 후 입력받습니다.
📔 풀이과정
option 1의 배팅률은 100 / optionOne이며
option 2의 배팅률은 100 / (100 - optionOne) 입니다.
📔 정답출력
상대오차에 맞춰 출력합니다.
📕 Code
#include <bits/stdc++.h>
using namespace std;
double optionOne;
int main(){
cin >> optionOne;
printf("%.10f\n%.10f", 100 / optionOne, 100 / (100 - optionOne));
}
'Algorithm > Implementation' 카테고리의 다른 글
(C++) - 백준(BOJ) 18883 : N M 찍기 (0) | 2022.05.18 |
---|---|
(C++) - 백준(BOJ) 9037 : The candy war (6) | 2022.05.14 |
(C++) - 백준(BOJ) 17356 : 욱 제 (0) | 2022.05.07 |
(C++) - 백준(BOJ) 6550 : 부분 문자열 (0) | 2022.05.05 |
(C++) - 백준(BOJ) 1996 : 지뢰 찾기 (0) | 2022.05.03 |