###### tags: `實作3級` `3.條件判斷` :::success 用最簡單方法 目標 實作3級 ::: # APCS實作2022-1 ## P1.cpp 程式交易 https://zerojudge.tw/ShowProblem?problemid=h081 https://yuihuang.com/zj-h081/  ```c++= #include <bits/stdc++.h> using namespace std; //111-6/30 //2022-6 P1數字遊戲 AC (2ms, 332KB) int main() { int a[10]= {0}; int c=0; //眾數的出現次數 int n; //輸入數字 for(int i=0; i<3; i++) { cin >> n; a[n]++; if(a[n]>c) { mode=n; c=a[n]; } } cout << c; for(int i=9; i>0; i--) { if(a[i]>0) cout << " " << i; } return 0; } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up