BASIC의 개발 노트
1205 : 최댓값 본문
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include <stdio.h> int main() { double a, b; double maxValue = 0; double powTmp = 1; scanf("%lf %lf", &a, &b); if (a + b > maxValue) maxValue = a + b; if (a - b > maxValue) maxValue = a - b; if (b - a > maxValue) maxValue = b - a; if (a * b > maxValue) maxValue = a * b; if (a / b > maxValue) maxValue = a / b; if (b / a > maxValue) maxValue = b / a; for(int i = 1; i <= b; i++) powTmp *= a; if (powTmp > maxValue) maxValue = powTmp; powTmp = 1; for(int k = 1; k <= a; k++) powTmp *= b; if (powTmp > maxValue) maxValue = powTmp; printf("%.6f", maxValue); return 0; } | cs |
'Algorithm > CodeUp' 카테고리의 다른 글
| 1207 : 윷놀이 (0) | 2019.04.28 |
|---|---|
| 1206 : 배수 (0) | 2019.04.28 |
| 1204 : 영어 서수로 표현하기 (0) | 2019.04.28 |
| 1180 : 만능 휴지통 (0) | 2019.04.28 |
| 1173 : 30분전 (0) | 2019.04.28 |
Comments