eolymp
bolt
Try our new interface for solving problems
published at 1/30/24, 10:12:10 am

include <iostream>

using namespace std; int main(){ int n,g=0; cin>>n; int a[n]; for ( int i=0; i<n; i++){ cin>>a[i]; } cout<<a[0]<<" "; for ( int i=0; i<n; i++){ g=0; if ( i!=0 ){ for ( int l=0; l<i; l++){ if ( a[i]==a[l]){ g=1; } } if ( g==0){ cout<<a[i]<<" "; } } } }

published at 4/19/24, 4:05:16 pm

include<iostream>

using namespace std; int main(){ int n,i,j,k; cin>>n; int x[n]; for(i=0;i<n;i++) cin>>x[i]; cout<<x[0]<<" "; for(i=1;i<n;i++){ k=0; for(j=i-1;j>=0;j--) if(x[i]==x[j]){ k=1; break; } if(k==0) cout<<x[i]<<" ";
} }