A - Presents
Problem description
Little Petya very much likes gifts. Recently he has received a new laptop as a New Year gift from his mother. He immediately decided to give it to somebody else as what can be more pleasant than giving somebody gifts. And on this occasion he organized a New Year party at his place and invited n his friends there.
If there's one thing Petya likes more that 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 his friends with integers from 1 to n. Petya remembered that a friend number i gave a gift to a friend number pi. He also remembered that each of his friends received exactly one gift.
Now Petya wants to know for 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 is pi — the number of a friend who gave a gift to friend number i. It is guaranteed that each friend received exactly one gift. It is possible that some friends do 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.
Examples
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
解题思路:输入n(n表示编号从1到n的学生总数)个数,第i个数表示编号为i的学生送礼物给编号为j的学生,要求输出编号为j的学生收到那个送他礼物的学生编号i,水过!
AC代码:
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,x,t[];
cin>>n;
for(int i=;i<=n;++i){cin>>x;t[x]=i;}
for(int i=;i<=n;++i)
cout<<t[i]<<(i==n?"\n":" ");
return ;
}
A - Presents的更多相关文章
- CodeForces 483B Friends and Presents
Friends and Presents Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I ...
- B. Friends and Presents(Codeforces Round #275(div2)
B. Friends and Presents time limit per test 1 second memory limit per test 256 megabytes input stand ...
- Codeforces483B. Friends and Presents(二分+容斥原理)
题目链接:传送门 题目: B. Friends and Presents time limit per test second memory limit per test megabytes inpu ...
- Codeforces 483B - Friends and Presents(二分+容斥)
483B - Friends and Presents 思路:这个博客写的不错:http://www.cnblogs.com/windysai/p/4058235.html 代码: #include& ...
- CF 483B. Friends and Presents 数学 (二分) 难度:1
B. Friends and Presents time limit per test 1 second memory limit per test 256 megabytes input stand ...
- Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) A. Little Artem and Presents 水题
A. Little Artem and Presents 题目连接: http://www.codeforces.com/contest/669/problem/A Description Littl ...
- codefoeces B. Friends and Presents
B. Friends and Presents time limit per test 1 second memory limit per test 256 megabytes input stand ...
- codeforces 669A A. Little Artem and Presents(水题)
题目链接: A. Little Artem and Presents time limit per test 2 seconds memory limit per test 256 megabytes ...
- Codeforces Round #275 (Div. 2) B. Friends and Presents 二分+数学
8493833 2014-10-31 08:41:26 njczy2010 B - Friends and Presents G ...
- A - Alice and the List of Presents (排列组合+快速幂取模)
https://codeforces.com/contest/1236/problem/B Alice got many presents these days. So she decided to ...
随机推荐
- hadoop单机环境配置
1.配置一台linux服务器(当前使用CentOS7)及一些基本设置 1.1在wmware下制作一台centos服务器(桥接模式) 并设置静态ip (编辑/etc/sysmconfig ...
- fiddler抓包 IOS11以上系统
想要使用fiddler对iphone X进行抓包,按照以前的配置方法,走一遍.还是抓不成,原来是因为IOS11操作系统中,安装完证书之后,还需要再手动信任证书才能正常抓包. 以下内容来自:https: ...
- 【转载】使用 IntelliJ IDEA 新建一个 web项目
IntelliJ IDEA 创建Web项目(全教程) 说明:IntelliJ IDEA 版本为14.JDK 版本为1.7tomcat 版本为apache-tomcat-7.0.70 注:在创建过程 ...
- Python 切片 day3
你可以处理列表的部分元素——Python称之为切片 . 一.使用方法: 要创建切片,可指定要使用的第一个元素和最后一个元素的索引. 与函数range() 一样,Python在到达你指定的第二个索引前面 ...
- 优化 RequireJS 项目(合并与压缩) 【已翻译100%】
英文原文:Optimize (Concatenate and Minify) RequireJS Projects 标签: RequireJS Node.js 参与翻译 (1人) : 裴宝亮 本文将演 ...
- 通过请求接口的办法获得本设备IP以及IP地址
获取本设备IP接口(搜狐) http://pv.sohu.com/cityjson?ie=utf-8 result Content: { "cip": "58.21 ...
- JAVA接口的简单实现
感觉越来越强烈, 我的心在跳~~~,我的宝剑在嘟~~ Flyer.java package cc.openhome; public interface Flyer{ public abstract v ...
- mybatis中useGeneratedKeys和keyProperty的使用
领域模型主键属性是shopId,使用JDBC的getGenereatedKeys方法获取主键并赋值到keyProperty设置的领域模型shopId属性中,配置参考如下:<insert id=& ...
- 奇妙的go语言(基本的语法)
[ 声明:版权全部,欢迎转载,请勿用于商业用途. 联系信箱:feixiaoxing @163.com] 学习一门新的语言无非就是从主要的语法開始的.通过语法书来学习语言毕竟是很枯燥的,所以我们最好还 ...
- hdu - 3498 - whosyourdaddy(反复覆盖DLX)
题意:N(2 ≤ N ≤ 55)个点,M(0 ≤ M ≤ N*N)条无向边,删除一个点会把与其相邻的点一起删掉.问最少删几次能够删掉全部点. 题目链接:pid=3498">http:/ ...