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

洛谷 P1320 压缩技术(续集版) 更多...

#include <luogu.h>

静态 Public 成员函数

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

详细描述

洛谷 P1320 压缩技术(续集版)

在文件 luogu.h480 行定义.

成员函数说明

◆ main()

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

在文件 luogu.cpp1654 行定义.

1654 {
1655 char ch;
1656 int current = 0;
1657 int count = 0;
1658 vector<int> ans;
1659 int n = 0;
1660 while(cin >> ch) {
1661 if(isdigit(ch) == 0) {
1662 continue;
1663 }
1664 n++;
1665 if(ch - '0' == current) {
1666 count++;
1667 } else {
1668 ans.push_back(count);
1669 current = (current + 1) % 2;
1670 count = 1;
1671 }
1672 }
1673 ans.push_back(count);
1674 cout << static_cast<int>(sqrt(n)) << " ";
1675 for(const auto i: ans) {
1676 cout << i << " ";
1677 }
1678 return 0;
1679 }

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


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