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

AcWing 4210. 数字 更多...

#include <acwing.h>

静态 Public 成员函数

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

详细描述

AcWing 4210. 数字

在文件 acwing.h490 行定义.

成员函数说明

◆ main()

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

在文件 acwing.cpp1359 行定义.

1359 {
1360 unsigned short a;
1361 cin >> a;
1362 unsigned int count = 0;
1363 for(int i = 2; i <= a - 1; i++) {
1364 unsigned short cpy = a;
1365 while(cpy != 0) {
1366 count += cpy % i;
1367 cpy /= i;
1368 }
1369 }
1370 unsigned int denominator = a - 2;
1371 unsigned int molecular = count;
1372 while(denominator % molecular != 0) {
1373 const unsigned int temp = denominator;
1374 denominator = molecular;
1375 molecular = temp % molecular;
1376 }
1377 cout << count / molecular << "/" << (a - 2) / molecular;
1378 return 0;
1379 }

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


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