###### tags: `APCS` `c++` # 題解 zerojudge g595: 1. 修補圍籬 APCS ```cpp= #include<bits/stdc++.h> using namespace std; int main(){ int n,h[105],ans=0; cin>>n; h[0]=101; h[n+1]=101; int i; for(i=1;i<=n;i++){ cin>>h[i]; } for(i=1;i<=n;i++){ if(h[i]==0){ ans+=min(h[i-1],h[i+1]); } } cout<<ans<<"\n"; } ```
×
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