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

AcWing 726. 质数 更多...

#include <acwing.h>

静态 Public 成员函数

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

详细描述

AcWing 726. 质数

在文件 acwing.h848 行定义.

成员函数说明

◆ main()

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

在文件 acwing.cpp2526 行定义.

2526 {
2527 int n;
2528 int x;
2529 cin >> n;
2530 for(int i = 0; i < n; i++) {
2531 cin >> x;
2532 for(int j = 2; j <= sqrt(x); j++) {
2533 if(x % j == 0) {
2534 cout << x << " is not prime" << endl;
2535 goto next;
2536 }
2537 }
2538 cout << x << " is prime" << endl;
2539 next:;
2540 }
2541 return 0;
2542 }

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


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