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

AcWing 777. 字符串乘方 更多...

#include <acwing.h>

静态 Public 成员函数

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

详细描述

AcWing 777. 字符串乘方

在文件 acwing.h1297 行定义.

成员函数说明

◆ main()

int acwing::acwing777::main ( istream &  cin,
ostream &  cout 
)
static

在文件 acwing.cpp4201 行定义.

4201 {
4202 string str;
4203 cin >> str;
4204 while(str != ".") {
4205 for(int i = 1; i <= str.length(); i++) {
4206 if(str.length() % i == 0) {
4207 bool ok = true;
4208 string substr = str.substr(0, i);
4209 for(int j = i; j < str.length(); j += i) {
4210 if(str.substr(j, i) != substr) {
4211 ok = false;
4212 break;
4213 }
4214 }
4215 if(ok) {
4216 cout << str.length() / i << endl;
4217 break;
4218 }
4219 }
4220 }
4221 cin >> str;
4222 }
4223 return 0;
4224 }

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


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