文章
71
粉丝
142
获赞
5
访问
52.9k
#include<iostream>
#include<string>
#include<random>
using namespace std;
int a[21] = {0};
int b[6];
int main() {
srand(time(0));
int sum = 0, ans = 0;
for (int i = 0; i < 5;i++) {
b[i] = rand() % 20 + 1;
a[b[i]] = 1;
ans += b[i];
}
for (int i = 1; i <= 20;i++) {
if (a[i] == 0) {
sum += i;
}
}
cout << ans + sum << endl;
return 0;
}
登录后发布评论
暂无评论,来抢沙发