#P2373. yyy2015c01 的 IDE 之 Call Stack
yyy2015c01 的 IDE 之 Call Stack
Description
As a member of his development team, you were unfortunately selected by yyy2015c01 to join the Debugger group.
The Debugger envisioned by yyy2015c01 consists of several parts, and one small component is the Call Stack—called “调用栈” in Chinese.
Since the IDE is still in internal testing, the team first needs a Call Stack that can recognize parameter lists to see how it performs. This task is assigned to you.
The imagined Call Stack can distinguish functions by recognizing parameter lists of int and char. The rules are:
int fac1(int n);
and
int fac1(char n);
are two different functions; but
int Fac1(int n,int m);
and
int FAC1(int x,int y);
are considered the same function. In other words, this Call Stack does not care about parameter names; it distinguishes by parameter types and a case-insensitive function name.
Note: int main() may appear or may not appear; regardless of whether it appears, it must not be counted as a function.
Please implement a Call Stack and, after all function calls complete, output how many distinct functions the program has (it is guaranteed that every function in the program is called at least once).
Input Format
The input has lines: the first line is a positive integer , indicating there are call operations; lines each contain one function call (strictly following the sample input format), and there will be no extra characters.
Output Format
Output one line: a positive integer , indicating how many functions with distinct parameter lists appear in the above calls.
2
FAC1 (N=233, M=65 'A', A=0)
main ()
1
2
fac1 (N=250)
FAC1 (a=987)
1
Hint
Each function has at most parameters, and the length of each input line does not exceed .
Salute to our protagonist, classmate yyy2015c01!
Translated by ChatGPT 5
京公网安备 11011102002149号