PAT 甲級 A1011 (2019/02/01)
阿新 • • 發佈:2019-02-22
cst print ble pan for rod return scan scanf
1 #include<cstdio> 2 int main(){ 3 double a, b, c, MAX, product = 1.0; 4 char WTL[3]; 5 for(int i = 0; i < 3; i++){ 6 scanf("%lf %lf %lf", &a, &b, &c); 7 MAX = a > b ? a : b; 8 MAX = c> MAX ? c : MAX; 9 MAX == a ? WTL[i] = ‘W‘ : MAX == b ? WTL[i] = ‘T‘ : WTL[i] = ‘L‘; 10 product *= MAX; 11 printf("%c ", WTL[i]); 12 } 13 printf("%.2f", (product*0.65-1)*2); 14 return 0; 15 } 16 /* 17 三目運算符運算優先級? 18 */
PAT 甲級 A1011 (2019/02/01)