X. [GESP]L3-202406-Q2405-J
[GESP]L3-202406-Q2405-J
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
执行下面 C++ 代码后,输出的结果不可能是 。
#include <iostream>
#include <cstdlib> // 为了使用 rand() 和 srand()
#include <ctime> // 为了使用 time()
using namespace std;
int main() {
// 设置随机种子
srand(time(NULL));
int i = 1;
int s[5];
while(i <= 5)
{
int a = rand() % 10;
if(a % 3 == (i + 1) % 3)
s[i++] = a;
}
for(int i = 1; i <= 5; i++)
cout << s[i];
cout << endl;
return 0;
}
{{ select(1) }}
- 正确
- 错误
GESP 2024.06 C++ 三级 全真模拟赛
- 状态
- 已结束
- 规则
- OI
- 题目
- 27
- 开始于
- 2026-11-20 13:30
- 结束于
- 2026-11-25 13:30
- 持续时间
- 2 小时
- 主持人
- 参赛人数
- 0