--- tags: APCS --- # b964 ``` //c++ #include <iostream> using namespace std; int main(){ int b,t; cin>>b; int a[b]={}; for(int i=0;i<b;i++){ cin>>a[i]; } int n = sizeof(a)/sizeof(int); for(int i = n-1; i > 0; i--){ for(int j = 0; j <= i-1; j++){ if( a[j] > a[j+1]) { t = a [j]; a[j] = a[j+1]; a[j+1] = t;} } } for(int i=0;i<b-1;i++) cout<<a[i]<<" "; cout<<a[b-1]; for(int i=0;i<b;i++){ if (a[i]>=60) { if (i==0) { cout<<endl<<"best case"; break;} cout<<endl<<a[i-1]; break;} if (i==(b-1)){ cout<<endl<<a[b-1]; } } for(int i=0;i<b;i++){ if (a[i]>=60) { cout<<endl<<a[i]; break;} if (i==(b-1)) { cout<<endl<<"worst case"; break;} } } ```
×
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