1 solutions
-
1
其实思路很简单,和“删除元素”这道题一样,使用假插入即可
#include<bits/stdc++.h> using namespace std; int n,a[11],x,y; int main(){ scanf("%d",&n); for(int i = 1;i<=n;i++)scanf("%d",&a[i]); scanf("%d%d",&x,&y); for(int i = 1;i<=n;i++) if(i == x)printf("%d %d ",y,a[i]); else printf("%d ",a[i]); return 0; }
- 1
Information
- ID
- 342
- Time
- 1000ms
- Memory
- 64MiB
- Difficulty
- 10
- Tags
- # Submissions
- 5
- Accepted
- 4
- Uploaded By