File size: 4,973 Bytes
7ab4270
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
code`block`FunctionDecl`FunctionDeclRec`ForStmt`ForStmtRec`DoStmt`DoStmtRec`WhileStmt`WhileStmtRec`IfStmt`IfStmtRec`SwitchStmt`SwitchStmtRec`countBlocks`countBlocksRec`countCondition`countVariable`countLiteral`IntegerLiteral`StringLiteral`IfStmt`ForStmt`WhileStmt`DoStmt`SwitchStmt`countLoop`VarDecl`DeclRefExpr`DeclStmt`countDecl`countPointer`writeFunction`CallExpr`BinaryOperator`UnaryOperator`CompoundAssignOperator`countOperand`ArraySubscriptE`RealFaultLocation
bool is_number(const std::string& s)`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`1`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0
    std::string::const_iterator it = s.begin();`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`1`1`0`0`0`0`0`0`0`0`0`1`1`1`3`1`0`0`0`0`0`0`0`0
    while (it != s.end() && std::isdigit(*it)) ++it;`FunctionDecl,false;WhileStmt,false;`1`0`0`0`0`0`1`0`0`0`0`0`2`0`7`4`0`0`0`0`0`1`0`0`1`0`8`0`8`0`0`1`1`0`0`1`0`0
    return !s.empty() && it == s.end();`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`1`3`0`0`0`0`0`0`0`0`0`0`4`0`4`0`0`0`1`1`0`2`0`0
inline int string_to_int(string s)`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0
    stringstream ss(s);`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`1`0`0`0`0`0`0`0`0`0`1`1`1`3`0`0`0`0`0`0`0`0`0
    int x;`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`0`0`0`0`0`0`0`0`0`0`1`0`1`2`0`0`0`0`0`0`0`0`0
    ss >> x;`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`2`0`0`0`0`0`0`0`0`0`0`3`0`3`0`0`0`0`0`0`0`0`0
    return x;`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`1`0`0`0`0`0`0`0`0`0`0`1`0`1`0`0`0`0`0`0`0`0`0
int main ()`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0
	ios_base::sync_with_stdio(0); cin.tie(0);`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`1`2`2`0`0`0`0`0`0`0`0`2`0`2`0`0`1`0`0`0`0`0`0
	vector<string> v;`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`0`0`0`0`0`0`0`0`0`0`1`0`1`2`0`0`0`0`0`0`0`0`0
	v.push_back("ABSINTH");`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`1`1`0`1`0`0`0`0`0`0`0`1`0`1`0`0`0`0`0`0`0`0`0
	v.push_back("BEER");`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`1`1`0`1`0`0`0`0`0`0`0`1`0`1`0`0`0`0`0`0`0`0`0
	v.push_back("BRANDY");`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`1`1`0`1`0`0`0`0`0`0`0`1`0`1`0`0`0`0`0`0`0`0`0
	v.push_back("CHAMPAGNE");`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`1`1`0`1`0`0`0`0`0`0`0`1`0`1`0`0`0`0`0`0`0`0`0
	v.push_back("GIN");`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`1`1`0`1`0`0`0`0`0`0`0`1`0`1`0`0`0`0`0`0`0`0`0
	v.push_back("RUM");`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`1`1`0`1`0`0`0`0`0`0`0`1`0`1`0`0`0`0`0`0`0`0`0
	v.push_back("SAKE");`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`1`1`0`1`0`0`0`0`0`0`0`1`0`1`0`0`0`0`0`0`0`0`0
	v.push_back("VODKA");`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`1`1`0`1`0`0`0`0`0`0`0`1`0`1`0`0`0`0`0`0`0`0`1
	v.push_back("WHISKEY");`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`1`1`0`1`0`0`0`0`0`0`0`1`0`1`0`0`0`0`0`0`0`0`0
	v.push_back("WINE");`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`1`1`0`1`0`0`0`0`0`0`0`1`0`1`0`0`0`0`0`0`0`0`0
	int n;`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`0`0`0`0`0`0`0`0`0`0`1`0`1`2`0`0`0`0`0`0`0`0`0
	while(cin >> n)`FunctionDecl,false;WhileStmt,false;`1`0`0`0`0`0`1`0`0`0`0`0`2`0`1`2`0`0`0`0`0`1`0`0`1`0`3`0`3`0`0`0`0`0`0`0`0`0
		int cnt = 0;`FunctionDecl,false;WhileStmt,false;`1`0`0`0`0`0`1`0`0`0`0`0`2`0`1`0`1`1`0`0`0`0`0`0`0`1`0`1`2`0`0`0`0`0`0`0`0`0
		string s;`FunctionDecl,false;WhileStmt,false;`1`0`0`0`0`0`1`0`0`0`0`0`2`0`1`0`0`0`0`0`0`0`0`0`0`1`0`1`2`0`0`0`0`0`0`0`0`0
		for (int i = 0; i < n; ++i)`FunctionDecl,false;WhileStmt,false;ForStmt,false;`1`0`1`0`0`0`1`0`0`0`0`0`3`0`2`3`1`1`0`0`1`0`0`0`1`1`3`1`5`0`0`0`1`1`0`2`0`0
			cin >> s;`FunctionDecl,false;WhileStmt,false;ForStmt,false;`1`0`1`0`0`0`1`0`0`0`0`0`3`0`2`2`0`0`0`0`0`0`0`0`0`0`3`0`3`0`0`0`0`0`0`0`0`0
			if (find(v.begin(), v.end(), s) != v.end()) cnt++;`FunctionDecl,false;WhileStmt,false;ForStmt,false;IfStmt,false;`1`0`1`0`0`0`1`0`1`0`0`0`4`0`6`5`0`0`0`1`0`0`0`0`0`0`7`0`7`0`0`1`0`1`0`1`0`0
			else if (is_number(s))`FunctionDecl,false;WhileStmt,false;ForStmt,false;IfStmt,false;IfStmt,false;`1`0`1`0`0`0`1`0`2`0`0`0`5`0`9`1`0`0`0`1`0`0`0`0`0`0`2`0`2`0`1`1`0`0`0`0`0`0
				int x = string_to_int(s);`FunctionDecl,false;WhileStmt,false;ForStmt,false;IfStmt,false;IfStmt,false;`1`0`1`0`0`0`1`0`2`0`0`0`5`0`9`1`0`0`0`0`0`0`0`0`0`1`2`1`4`0`1`1`0`0`0`0`0`0
				if (x < 18) cnt++;`FunctionDecl,false;WhileStmt,false;ForStmt,false;IfStmt,false;IfStmt,false;IfStmt,false;`1`0`1`0`0`0`1`0`3`0`0`0`6`0`10`2`1`1`0`1`0`0`0`0`0`0`2`0`2`0`0`0`1`1`0`2`0`0
		cout << cnt << endl;`FunctionDecl,false;WhileStmt,false;`1`0`0`0`0`0`1`0`0`0`0`0`2`0`1`2`0`0`0`0`0`0`0`0`0`0`5`0`5`0`0`0`0`0`0`0`0`0
	return 0;`FunctionDecl,false;`1`0`0`0`0`0`0`0`0`0`0`0`1`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0`0