求大佬解答,只有20分

P1422 小玉家的电费

@[Richard_chen](/user/321266) ```while```是循环啊
by Marser @ 2020-03-13 10:11:43


@Marser谢谢谢谢,我手贱用什么while
by Richard_chen @ 2020-03-13 10:13:18


@[Marser](/user/17930) 小萌新谢谢您的帮助,通过了
by Richard_chen @ 2020-03-13 10:16:41


```cpp #include<bits/stdc++.h> using namespace std; int main() { double sum = 0, n; cin >> n; if(n <= 150) { sum += n * 0.4463; } else if(n > 150 && n <= 400) { sum += 150 * 0.4463; sum += (n - 150) * 0.4663; } else { sum += 150 * 0.4463; sum += 250 * 0.4663; sum += (n - 400) * 0.5663; } cout << fixed << setprecision(1) << sum; return 0; } ``` 请大家看一下我的 我用的cout和setprecision(1)
by 159号程序员 @ 2020-04-01 21:11:28


上一页 |