1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <iostream> using namespace std; int n; int d[1000]; int main() { cin >> n; for (int i = 0; i < n; ++i) cin >> d[i]; int ans = -1; for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) if (d[i] < d[j]) ans = max(ans, d[i] + d[j] - (d[i] & d[j])); cout << ans; return 0; } |
假设输入的 n和 d[i]都是不超过 10000 的正整数,完成下面的判断题和单选题:
0 of 6 Questions completed
Questions:
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
0 of 6 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
1、n 必须小于 1000,否则程序可能会发生运行错误。
2、输出一定大于等于 0。
3、若将第 13 行的 j=0
改为 j = i + 1
程序输出可能会改变。 ( )
4、将第 14 行的 d[i] < d[j]
改为 d[i] != d[j]
,程序输出不会改变。( )
5、若输入 n 为 100,且输出为 127,则输入的 d[i] 中不可能有( )。
6、若输出的数大于 0,则下面说法正确的是( )。