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

洛谷 P5719 【深基4.例3】分类平均 更多...

#include <luogu.h>

静态 Public 成员函数

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

详细描述

洛谷 P5719 【深基4.例3】分类平均

在文件 luogu.h239 行定义.

成员函数说明

◆ main()

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

在文件 luogu.cpp661 行定义.

661 {
662 int n;
663 int k;
664 cin >> n >> k;
665 int sum_a = 0;
666 int count_a = 0;
667 int sum_b = 0;
668 int count_b = 0;
669 for(int i = 1; i <= n; i++) {
670 if(i % k == 0) {
671 sum_a += i;
672 count_a++;
673 } else {
674 sum_b += i;
675 count_b++;
676 }
677 }
678 cout << fixed << setprecision(1) << static_cast<double>(sum_a) / static_cast<double>(count_a) << " " << static_cast<double>(sum_b) / static_cast<double>(count_b);
679 return 0;
680 }

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


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