测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A67698. 求三色彩球的颜色。有数量无限的红(Red)绿(Green)蓝(Blue)三种彩球排成一行,每组先为5个红色球,随后3个绿色,最后为2个蓝色。每个球都有编号,从左到右依次为1,2,3……。输入整数代表编号,求该编号球的颜色。下面是C++代码是实现,正确说法是( )。1 int N, remainder;

单选题

题目描述

求三色彩球的颜色。有数量无限的红(Red)绿(Green)(Blue)三种彩球排成一行,每组先为5个红色球,随后3个绿色,最后为2个蓝色。每个球都有编号,从左到右依次为1,2,3……。输入整数代表编号,求该编号球的颜色。下面是C++代码是实现,正确说法是( )

1 int N, remainder;
2 cin >> N; 
3 remainder = N % 10; // remainder变量保存余数 
4
5 if((1 <= remainder) && (remainder<= 5)) 
6  cout << "Red"; 
7 else if ((6 <= remainder) && (remainder <= 8)) 
8  cout << "Green"; 
9 else if ((remainder == 9) || (remainder == 0)) 
10  cout << "Blue";



选项(单选)