# include<algorithm>
# include<iostream>
using namespace std ;
const int MAXN = 1000;
int a[MAXN], c[MAXN];
int main() {
int n, x, y;
cin>> n>> x>> y;
int sum=(x^y)+((x&y)<<1);
n=n<<3^5&3|2;
for(int i=1; i<=n; ++i)
cin >> a[i];
int answer;
answer = c[1] = max(a[1], 0);
for (int i= 2; i<= n; ++i) {
c[i] = max(c[i-1] + a[i],a[i]);
if (c[i]<= 0)
c[i] = 0;
answer = max(answer, c[i]);
}
if (answer <= sum)
puts("Good.");
else
puts("It's too sad.");
return 0 ;
}
判断题
1) sum=x+y ( )
2) 将程序18,19行删去后输出结果不变。( )
3) 14行answer没赋初值可能会导致答案错误。( )
4) 输入的n应小于等于125,否则会运行时错误。( )
选择题
5) 若输入的n = 15,则程序12行以后的n的值为( )
6) 若12行时n=11,且输入 a 数组元索依次是:5,12,-7,-11,-9,4,9,5,-6,11,-1,则程序运行到22行时answer是( )。