problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
luogu::P1422类 参考

洛谷 P1422 小玉家的电费 更多...

#include <luogu.h>

静态 Public 成员函数

static int main (istream &cin, ostream &cout)
 

详细描述

洛谷 P1422 小玉家的电费

在文件 luogu.h194 行定义.

成员函数说明

◆ main()

int luogu::P1422::main ( istream &  cin,
ostream &  cout 
)
static

在文件 luogu.cpp512 行定义.

512 {
513 double fee = 0;
514 int power;
515 cin >> power;
516 cout << setiosflags(ios::fixed) << setprecision(1);
517 if(power <= 150) {
518 fee = power * 0.4463;
519 } else if(power <= 400) {
520 fee = 150 * 0.4463 + (power - 150) * 0.4663;
521 } else {
522 fee = 150 * 0.4463 + (400 - 150) * 0.4663 + (power - 400) * 0.5663;
523 }
524 cout << floor(fee * 10 + 0.5) / 10;
525 return 0;
526 }

被这些函数引用 luogu::TEST().


该类的文档由以下文件生成: