1 solutions

  • 0
    @ 2024-10-18 23:13:06

    #include <stdio.h> int main() { int N,i,t,m; int cnt=0; scanf("%d",&N); int a[1001]={0}; for(i=0;i<N;i++){ scanf("%d",&t); if(a[t]==0){ a[t]=t; cnt++; } } printf("%d",cnt); printf("\n"); for(i=0;i<N;i++){ for(int i=0;i<N-1;i++){ if(a[i]>a[i+1]){ m=a[i]; a[i]=a[i+1]; a[i+1]=m; } } } for(i=0;i<1001;i++){ if(a[i]!=0){ printf("%d ",a[i]); } } return 0; }

    • 1

    Information

    ID
    6836
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    6
    Tags
    (None)
    # Submissions
    61
    Accepted
    21
    Uploaded By