# 12614 - Game Shopping ## 題解: 只要bill不夠買目前的遊戲,就會跳過去買下一個, 直到可以買才會換下一個bill。 ## Code: ```c=1 #include <stdio.h> #define N 1000 + 5 int n, m, c[N], a[N]; int main(){ scanf("%d%d", &n, &m); for(int i=0; i<n; i++) scanf("%d", c + i); for(int i=0; i<m; i++) scanf("%d", a + i); int ans = 0; for(int i=0, j=0; i<n && j<m; i++){ if(c[i] <= a[j]) ans++, j++; } printf("%d\n", ans); return 0; } ``` ###### tags: `NTHUOJ`
×
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