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

AcWing 1875. 贝茜的报复 更多...

#include <acwing.h>

静态 Public 成员函数

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

详细描述

AcWing 1875. 贝茜的报复

在文件 acwing.h770 行定义.

成员函数说明

◆ main()

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

在文件 acwing.cpp2204 行定义.

2204 {
2205 auto b = vector<int>();
2206 auto e = vector<int>();
2207 auto s = vector<int>();
2208 auto i = vector<int>();
2209 auto g = vector<int>();
2210 auto o = vector<int>();
2211 auto m = vector<int>();
2212 unsigned short n;
2213 cin >> n;
2214 for(unsigned short j = 0; j < n; j++) {
2215 char ch;
2216 int val;
2217 cin >> ch >> val;
2218 switch(ch) {
2219 case 'B':
2220 b.push_back(val);
2221 break;
2222 case 'E':
2223 e.push_back(val);
2224 break;
2225 case 'S':
2226 s.push_back(val);
2227 break;
2228 case 'I':
2229 i.push_back(val);
2230 break;
2231 case 'G':
2232 g.push_back(val);
2233 break;
2234 case 'O':
2235 o.push_back(val);
2236 break;
2237 case 'M':
2238 m.push_back(val);
2239 break;
2240 default: return 1;
2241 }
2242 }
2243 unsigned int count_a = 0;
2244 for(const auto ms: m) {
2245 if(ms % 2 != 0) {
2246 count_a++;
2247 }
2248 }
2249 unsigned int count_b = 0;
2250 for(const auto bs: b) {
2251 for(const auto is: i) {
2252 if((bs + is) % 2 != 0) {
2253 count_b++;
2254 }
2255 }
2256 }
2257 unsigned int count_c = 0;
2258 for(const auto gs: g) {
2259 for(const auto os: o) {
2260 for(const auto es: e) {
2261 for(const auto ss: s) {
2262 if((gs + os + es + ss) % 2 != 0) {
2263 count_c++;
2264 }
2265 }
2266 }
2267 }
2268 }
2269 const unsigned long long count = b.size() * e.size() * s.size() * i.size() * g.size() * o.size() * m.size();
2270 cout << count - count_a * count_b * count_c;
2271 return 0;
2272 }
void ms(vector< int > &arr, int l, int r, int *ans)
Definition: acwing.cpp:6334

引用了 acwing::acwing788::ms().

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


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