반응형
https://www.acmicpc.net/problem/4696
4696번: St. Ives
Input consists of multiple data sets. Each data set consists of a line with a single floating point number number representing the numbers of wives, sacks per wife, cats per sack, and kittens per cat that Robert encountered that year. End of input is indic
www.acmicpc.net
간단 구현문제였습니다.
📕 풀이방법
📔 입력 및 초기화
공식을 적용할 a를 선언 후 입력받습니다.
📔 정답출력
공식을 적용한 결과를 형식에 맞게 출력합니다.
📕 Code
#include <bits/stdc++.h>
using namespace std;
double a;
int main(){
while(1){
cin >> a;
if(a == 0) break;
printf("%.2f\n", 1 + a + pow(a,2) + pow(a,3) + pow(a,4));
}
}
*더 나은 내용을 위한 지적, 조언은 언제나 환영합니다.
'Algorithm > Implementation' 카테고리의 다른 글
(Python3) - 백준(BOJ) 14782 : Bedtime Reading, I (0) | 2022.08.01 |
---|---|
(C++) - 백준(BOJ) 25285 : 심준의 병역판정검사 (0) | 2022.07.31 |
(C++) - 백준(BOJ) 3512 : Flat (0) | 2022.07.28 |
(C++) - 백준(BOJ) 2712 : 미국 스타일 (0) | 2022.07.27 |
(C++) - 백준(BOJ) 24724번 : 현대모비스와 함께하는 부품 관리 (0) | 2022.07.26 |