20分求助

P1422 小玉家的电费

有个超级暴力的做法。 ```cpp #include <iostream> using namespace std; double cost[10005]; int a,i; double b(0); int main(){ cin>>a; for(i=1;i<=150;i++)cost[i]=0.4463; for(i=151;i<=400;i++)cost[i]=0.4663; for(i=401;i<=10000;i++)cost[i]=0.5663; for(i=1;i<=a;i++)b+=cost[i]; b=int((b*10)+0.5)/10.0; cout<<b<<endl; return 0; } ```
by JDS070115 @ 2022-02-27 15:34:44


@[gaoyidong](/user/620260) (因为您的审题或数学能力出了点问题,所以 a > 150 的两部分算错了。建议重新读题。
by xutongwei @ 2022-02-27 15:36:19


谢谢
by chickencxk @ 2022-02-28 19:07:14


|