#1593. 珅泽教育CSP-J第一轮模拟考第四套 第 32 题
珅泽教育CSP-J第一轮模拟考第四套 第 32 题
第三题
#include<iostream>
const int mod = 1000000007;
int exp();
int term()
{
char dummy;
std::cin >> dummy;
int t = exp();
std::cin >> dummy;
if (t == 0) return 1;
else return t*2 % mod;
}
int exp()
{
int result = 0;
while (std::cin.peek() == '(')
{
result += term();
result %= mod;
}
return result;
}
int main()
{
std::cout << exp();
}
计分规则中,AB 的分数是 A 与 B 的和,对应代码中的( )部分实现。
{{ select(1) }}
term()中的t*2exp()中的result += term()term()中的return 1main()中的输出