2034 整數的個數

CRt0729發表於2024-06-28
#include<bits/stdc++.h>
#define f(i,s,e) for(int i = s; i <= e; i++)
#define ll long long
using namespace std;
const int N = 1e3+10,inf = 0x3f3f3f3f;

int main()
{
    int n,sum1 = 0,sum5 = 0,sum10 = 0; 
    cin >> n;
    for(int i = 1; i <= n; i++) //迴圈n次
    {
        int x; cin >> x; //每次迴圈都輸入一個數字x
        if(x == 1) sum1++; //1出現 
        if(x == 5) sum5++; //5出現
        if(x == 10) sum10++; //10出現    
    } 
    cout << sum1 << endl;
    cout << sum5 << endl;
    cout << sum10 << endl;
    return 0;
}

相關文章