Codeforces 136A presents (water problem)

Source: Internet
Author: User
Tags time limit
Presents
Click to open the topic
Time limit per test 2 seconds memory limit per test megabytes input standard input output standard output


Little Petya very much likes gifts. Recently he had received a new laptop as a new year gift from his mother. He immediately decided to give it-somebody else as what can is more pleasant than giving somebody gifts. And on the occasion he organized a New year party at the He place and invited n his friends there.



If there ' s one thing Petya likes more then receiving gifts, that's watching others giving gifts to somebody else. Thus, he safely hid the laptop until the next New year and made up his mind to watch his friends exchanging gifts while he Does not participate in the process. He numbered all the friends with integers from 1 to N. Petya remembered the A friend number I gave a gift to a friend num ber Pi. He also remembered that all of his friends received exactly one gift.



Now Petya wants to know-each friend I, the number of a friend who has given him a gift. Input



The first line contains one integer n (1≤n≤100)-the quantity of Friends Petya invited to the party. The second line contains n space-separated integers:the i-th number are pi-the number of a friend who gave a gift to Fri End number I. It is guaranteed this each friend received exactly one gift. It is possible that some friends does not share Petya's ideas of giving gifts to somebody else. Those friends gave the gifts to themselves. Output



Print n space-separated integers:the i-th number should equal the number of the friend who gave a gift to friend number I . Sample Test (s) Input


4
2 3) 4 1
Output
4 1 2 3
Input
3
1 3 2
Output
1 3 2
Input
2
1 2
Output
1 2

Not much, the key is to read the question.
Code:
#include <iostream>
#include <memory.h>
using namespace std;
int main ()
{
    int a[110],b[110],n,count1,i;
    while (Cin>>n)
    {
        count1=0;
        Memset (b,0,sizeof (b));
        for (i=0; i<n; i++)
        {
            cin>>a[i];
            b[a[i]]=i+1;
        }
        for (i=0; i<110; i++)
        {
            if (b[i]!=0)
            {
                if (count1==n-1)
                {
                    cout<<b[i]<< Endl;
                    break;
                }
                cout<<b[i]<< "";
                count1++
    ;
    }}} return 0;
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.