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

洛谷 P2141 [NOIP2014 普及组] 珠心算测验 更多...

#include <luogu.h>

静态 Public 成员函数

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

详细描述

洛谷 P2141 [NOIP2014 普及组] 珠心算测验

在文件 luogu.h431 行定义.

成员函数说明

◆ main()

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

在文件 luogu.cpp1410 行定义.

1410 {
1411 int n;
1412 cin >> n;
1413 auto s = set<int>();
1414 for(int i = 0; i < n; i++) {
1415 int num;
1416 cin >> num;
1417 s.insert(num);
1418 }
1419 int ans = 0;
1420 for(auto i = s.begin(); i != s.end(); ++i) {
1421 for(auto j = s.begin(); j != i; ++j) {
1422 int sub = *i - *j;
1423 if(sub != *j && s.contains(sub)) {
1424 ans++;
1425 break;
1426 }
1427 }
1428 }
1429 cout << ans;
1430 return 0;
1431 }

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


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