1145:0 start-up algorithm 52--array of deletions II time limit:1 Sec Memory limit:64 MB 64bit IO Format:%lld
submitted:2935 accepted:793
[Submit] [Status] [Web Board] Description
Deletes the number in the given array
Input
Multiple sets of tests, enter 1 integers n (n<20) and then n integers in the first row of each group
Enter 1 integer m in the second line
Output
Delete the number m in the first row of n integers (multiple words are removed), and then output the remaining number in order. If all the numbers in the array are deleted, direct output line breaks
Sample Input
5 1 2 3 4 33
Sample Output
1 2 4
Source
0 Starting point Learning algorithm
1#include <stdio.h>2 intMain () {3 intn,a[ -];4 while(SCANF ("%d", &n)! =EOF) {5 for(intI=0; i<n;i++){6scanf"%d",&a[i]);7 }8 9 intm,t,cout=0;Tenscanf"%d",&m); One for(intI=0; i<n;i++){ A if(m==A[i]) { -t=A[i]; -a[i]=a[i+1]; thea[i+1]=T; -cout++; - } - } + - for(intI=0; i<n-cout;i++){ +printf"%d", A[i]); A } atprintf"%d\n", a[n-cout]); - } - return 0; -}
1145:0 start-up algorithm 52--array of censored II (there is a problem!) )