第19781题 单选题
给定实现三色球颜色判断功能的C++代码,下列说法正确的是?

有数量无限的红(Red)、绿(Green)、蓝(Blue)三种彩球排成一行,每组排列顺序为5个红色球、3个绿色球、2个蓝色球。球从左到右编号依次为1,2,3……。输入整数代表球的编号,求该编号对应球的颜色。以下是实现该功能的C++代码:

int N, remainder;
cin >> N;
remainder = N % 10; // remainder变量保存余数

if((1 <= remainder) && (remainder <= 5))
    cout << "Red";
else if ((6 <= remainder) && (remainder <= 8))
    cout << "Green";
else if ((remainder == 9) || (remainder == 0))
    cout << "Blue";
{{ option.label }}
子题{{ index + 1 }} {{ child.type_label }}
{{ option.label }}
✓ 正确 ◐ 部分正确 ✗ 错误
程序运行统计
暂无判题统计
提交{{ questionInfo.stats ? questionInfo.stats.submit_count : 0 }}次 正确率{{ statsAccuracy }}%
答案解析