cpp发答案: #include <bits/stdc++.h> using namespace std; int a[10002]; int b[10002]; int n; int k,x,y; void sum(){ int num=0; for(int i=1;i<=n;i++) num+=a[i]; cout<<num<<endl; return ; } void right(){ for(int i=n;i>=1;i--) cout<<a[i]<<" "; cout<<endl; return; } void maxn(){ int maxs=-9889765; int num; for(int i=1;i<=n;i++){ if(a[i]>maxs) { maxs=a[i]; num=i; } } cout<<maxs<<" "<<num<<endl; } void minn(){ int minn=99999999; int num; for(int i=n;i>=1;i--){ if(minn>a[i]){ minn=a[i]; num=i; } } cout<<minn<<" "<<num<<endl; } void bort(){ int ans=0; for(int i=1;i<=n;i++){ if(a[i]>10&&a[i]<100) ans++; } cout<<ans<<" "; for(int i=1;i<=n;i++){ if(a[i]>10&&a[i]<100) cout<<a[i]<<" "; } cout<<endl; } void scin(){ for(int i=1;i<=n;i++) { if(i==k) cout<<x<<" "; cout<<a[i]<<" "; } cout<<endl; } void cut(){ for(int i=1;i<k;i++) b[i]=a[i]; for(int i=k+1;i<=n+1;i++){ b[i]=a[i-1]; } b[k]=x; for(int i=1;i<=n+1;i++){ if(i!=y) cout<<b[i]<<" "; } cout<<endl; } int main() { cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; cin>>k>>x>>y; sum(); right(); maxn(); minn(); bort(); scin(); cut(); return 0; }
共 8 条回复
哪道题
"@"<a href="/user/1">root</a>
"@"rootooooooooooooooo,我@起了!!!!
Even226
逗比
刷题王
???