Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
39664 刁泓烨 整数去重 C++ Accepted 1 MS 272 KB 408 2022-10-03 10:59:44

Tests(3/3):


Code:

#include <cstdio> #include <string> #include <cstring> #include <iostream> using namespace std; int main () { int n; cin>>n; int x[n+1]; memset(x,0,sizeof(x)); int temp; for(int i=1;i<=n;i++) { cin>>x[i]; } for(int i=1;i<=n;i++) { for(int j=i+1;j<=n;j++) { if(x[i]==x[j]) x[j]=0; } } for(int i=1;i<=n;i++) { if(x[i]) printf("%d ",x[i]); } return 0; }