一、客观题
1 C
2 C
3 B
4 B
分析:这是NOIP普及组的第1道选择题。由负数的补码求原码有两种方式。一是减1取反,二是取反加1。第二种方法的原理为负数的补码的补码为原码。
5 A
二、完成程序
T2
#include <cstdio>int main(){freopen("T2.in", "r", stdin);freopen("T2.out", "w", stdout);int a, b, c;scanf("%d %d %d", &a, &b, &c);int ans = a * 0.2 + b * 0.3 + c * 0.5;printf("%d\n", ans);return 0;}
T3
#include <iostream>#include <algorithm>#include <cstdio>using namespace std;int main(){freopen("T3.in", "r", stdin);freopen("T3.out", "w", stdout);const int n = 6;int a[n];for(int i = 0; i < n; i++){cin >> a[i];}sort(a, a + 6);for(int i = 0; i < n; i++){cout << a[i] << ' ';}return 0;}
了解少儿编程、信息学竞赛请加微信307591841或QQ307591841