1005. 7.2 Printing distinct numbers



Time Limit: 1sec    Memory Limit:256MB
Description

Use pointers on array to write a program that reads in n integers and displays distinct numbers (ie., if a number appears multiple times, it is displayed only once).
 

Input

The first line is a positive integer t for the number of test cases.
Each test case contains two lines. The first line is an integer n (0  

Output

For each test case, outputs the distinct numbers in order in which they were read, seperated by one blank.
 

Sample Input
 Copy sample input to clipboard
2
3
1 2 1
4
2 1 2 1
Sample Output
1 2
2 1

Problem Source: 程序设计I Chapter7 Pointers and C-String

// Problem#: 14320
// Submission#: 3675888
// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
// URI: http://creativecommons.org/licenses/by-nc-sa/3.0/
// All Copyright reserved by Informatic Lab of Sun Yat-sen University
#include
using namespace std;
int main()
{
    int T=0,count1=0;
    cin>>T;
    while(count1>n;
       
        int a[100];
        int b[100];
        for (int i=0; i<100; i++) {
            a[i]=0;
        }
        for (int i=0; i<100; i++) {
            b[i]=0;
        }
        for (int i=0; i>a[i];
        }
        b[0]=a[0];
        for (int j=1; j


conclusion:
Time Limit: 1sec    Memory Limit:256MB
Description

Use pointers on array to write a program that reads in n integers and displays distinct numbers (ie., if a number appears multiple times, it is displayed only once).
 

Input

The first line is a positive integer t for the number of test cases.
Each test case contains two lines. The first line is an integer n (0  

Output

For each test case, outputs the distinct numbers in order in which they were read, seperated by one blank.
 

Sample Input
 Copy sample input to clipboard
2
3
1 2 1
4
2 1 2 1
Sample Output
1 2
2 1

Problem Source: 程序设计I Chapter7 Pointers and C-String

你可能感兴趣的:(1005. 7.2 Printing distinct numbers)