1 条题解

  • 5
    @ 2026-6-4 22:16:31
    #include <bits/stdc++.h>
    using namespace std;
    int main() {
    int a[8], cnt1 = 0;
        for(int i = 0; i < 8; i++)
        {
            cin >> a[i];
            if(a[i] == 1) cnt1++;
        }
        int ans = 0;
        if(cnt1 > 4)
        {
            ans = (cnt1 - 4) / 2;
        }
        else if(cnt1 < 4)
        {
            ans = (4 - cnt1) / 2;
        }
        cout << ans;
        return 0;
    }
        
    
    
    • 1

    信息

    ID
    31001
    时间
    1000ms
    内存
    256MiB
    难度
    5
    标签
    (无)
    递交数
    25
    已通过
    12
    上传者