上海月赛丙组zzzz 题目描述 Alice 有三个水瓶,如果有至少两个瓶子都是空的,那么 Alice 就会把它们灌满水,但如果只有至多一个瓶子是空的,Alice 什么也不会做。
0 B 1 =0 则表示第一个水瓶是空的。类似地, 𝐵 2 , 𝐵 3 B 2 ,B 3 分别表示第二、三个水瓶的灌水情况。
如果 Alice 需要给水瓶灌水,输出一行 Water filling time,否则输出一行 Not now。
输入格式 第一行一个整数 𝑇 T 表示数据组数。
对于每组数据,一行三个整数 𝐵 1 , 𝐵 2 , 𝐵 3 B 1 ,B 2 ,B 3 。
输出格式 对每组数据,输出一行 Water filling time 或 Not now。
数据范围 对于 100 % 100% 的数据, 1 ≤ 𝑇 ≤ 1000 1≤T≤1000, 𝐵 𝑖 B i 是 0 0 或 1 1。
#include <iostream>
using namespace std;
int main() {
int T;
cin>>T;
while (T--) {
int B1 B2,B3;
cin>>B1>>B2>>B3;
int emptyCount = 0;
if (B1==0) {
emptyCount++;
}
if (B2 == 0) {
emptyCount++;
}
if (B3==0) {
emptyCount++;
}
if (emptyCount>=2) {
cout<<"Water filling time"<<endl;
} else {
cout<<"Not now"<< endl;
}
}
return 0;
}