#include using namespace std;

int main() { int n; cin >> n;

bool flag = false; // 初始化flag为false

for (int i = 0; i < n; i++)
{
    int num;
    cin >> num;
    
    if (num % 2 == 0) // 判断当前数是否为偶数
    {
        flag = true; // 如果存在偶数,将flag置为true
        break; // 找到一个偶数即可退出循环
    }
}

if (flag)
    cout << "Yes" << endl;
else
    cout << "No" << endl;

return 0;

}

输入n个整数如果存在偶数输出Yes否则输出No。输入 共两行。第一行为一个整数n。第二行为n个整数。输出 如果n个整数中存在偶数输出Yes否则输出No。输入样例1 51 2 3 4 5输出样例1 Yes输入样例2 41 1 3 3输出样例2 No用时内存 1000MS100MB编辑区提交#include iostreamusing namespace std;int main int n a

原文地址: https://www.cveoy.top/t/topic/ie1F 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录