为什么不对呀????

ljy2022 2022-07-23 21:00:27 20

#include<bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); int a,x,y,z; cin>>a; int f[a+1]; int he=0,m=0,n=10000,e,l,g=0; for(int i=1;i<=a;i++){ cin>>f[i]; he+=f[i]; if(f[i]>m){ m=f[i]; e=i; } if(f[i]<=n){ n=f[i]; l=i; } if(f[i]>10&&f[i]<100) g++; } cin>>x>>y>>z; cout<<he<<endl; for(int i=a;i>=1;i--) cout<<f[i]<<" "; cout<<endl; cout<<m<<" "<<e<<endl<<n<<" "<<l<<endl; cout<<g<<" "; for(int i=1;i<=a;i++){ if(f[i]>10&&f[i]<100) cout<<f[i]<<" "; } cout<<endl; for(int i=1;i<=a;i++){ cout<<f[i]<<" "; if(i==x-1) cout<<y<<" "; } cout<<endl; for(int i=1;i<=a;i++){ if(i!=z) cout<<f[i]<<" "; if(i==x-1&&i+1!=z) cout<<y<<" "; } return 0; }

{{ vote && vote.total.up }}

共 6 条回复

Ecky7 吉祥物

@root

ykj86

ykj11 谢谢

ljy2022

拿着满分试卷谢大佬

root 站长

6,7问错了!

root 站长
//6
    int k, x;
    cin >> k >> x;
    for (int i = n; i >= k; i--) a[i + 1] = a[i];
    a[k] = x;
    for (int i = 1; i <= n + 1; i++) cout << a[i] << " ";
    cout << endl;
// 7
    int y;
    cin >> y;
    for (int i = y; i < n + 1; i++) a[i] = a[i + 1];
    for (int i = 1; i <= n; i++) cout << a[i] << " ";
ljy2022

555……