In P1422 小玉家的电费

P1422 小玉家的电费

@[sunyunfan](/user/309983) 您这是公然索要代码么
by 风浪之子Mht @ 2020-01-16 17:19:10


出门右转题解区不谢
by Star_Wind @ 2020-01-16 17:19:15


@[sunyunfan](/user/309983) ``` #include <iostream> #include <iomanip> using namespace std; int main() { int m; double x; cin>>m; if(m<=150) cout<<setprecision(1) << fixed <<m*0.4463<<endl; else if(m<=400) cout<<setprecision(1) << fixed <<150*0.4463+(m-150)*0.4663<<endl; else cout<<setprecision(1) << fixed <<150*0.4463+250*0.4663+(m-400)*0.5663<<endl; return 0; } ``` 但是我插一句你这样有什么意义吗?
by Iodine_monochloride @ 2020-01-16 17:24:12


@[sunyunfan](/user/309983) 看看题解就行 里面解释的很清楚
by michael_song @ 2020-01-16 17:47:51


```cpp #include<bits/stdc++.h> using namespace std; int main(){ long long a; long double b; cin>>a; if(a<=150){ b=a*0.4463; }else if(a>=151&&a<=400){ b=150*0.4463+(a-150)*0.4663; }else{ b=150*0.4463+250*0.4663+(a-400)*0.5663; } cout<<fixed<<setprecision(1)<<b; return 0; } ```
by zhouzhiyuan @ 2020-06-06 15:40:29


```c #include <iostream> #include <iomanip> using namespace std; int main() { int m; double x; cin>>m; if(m<=150) cout<<setprecision(1) << fixed <<m*0.4463<<endl; else if(m<=400) cout<<setprecision(1) << fixed <<150*0.4463+(m-150)*0.4663<<endl; else cout<<setprecision(1) << fixed <<150*0.4463+250*0.4663+(m-400)*0.5663<<endl; return 0; } ``` 但兄弟,这有意义吗???
by CALEBcwh2 @ 2022-07-01 13:12:20


|