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

洛谷 P1161 开灯 更多...

#include <luogu.h>

静态 Public 成员函数

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

详细描述

洛谷 P1161 开灯

在文件 luogu.h449 行定义.

成员函数说明

◆ main()

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

在文件 luogu.cpp1482 行定义.

1482 {
1483 int n;
1484 auto *lamp = new bool[2000001];
1485 memset(lamp, 0, 2000001 * sizeof(bool));
1486 cin >> n;
1487 for(int i = 0; i < n; i++) {
1488 double a;
1489 int t;
1490 cin >> a >> t;
1491 for(int j = 1; j <= t; j++) {
1492 const int at = a * j;
1493 lamp[at] = !lamp[at];
1494 }
1495 }
1496 for(int i = 0; i < 2000001; i++) {
1497 if(lamp[i]) {
1498 cout << i;
1499 break;
1500 }
1501 }
1502 delete[] lamp;
1503 return 0;
1504 }

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


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