15 条题解

  • 0
    @ 2025-3-25 19:28:50

    #include<iostream> using namespace std; int main() { int n; int count = 0, con = 0; while (cin >> n) { //可以利用while一直输入 if (n == 0) break; //利用结尾为0,停止输入 if (n % 2 == 0) { count++;//给偶数计数 } if (n % 2 == 1) { con += n;//如果是奇数,那就算所有的奇数之和 } } cout << count << endl << con; return 0; }

    信息

    ID
    8
    时间
    1000ms
    内存
    256MiB
    难度
    5
    标签
    递交数
    2757
    已通过
    1032
    上传者