ZOJ 3492 F - Kagome Kagome
来源:互联网 发布:360浏览器精简优化版 编辑:程序博客网 时间:2024/04/26 03:49
F - Kagome KagomeDescriptionKagome kagome, kago no naka no tori waItsu itsu deyaru? Yoake no ban niTsuru to kame to subetta.Ushiro no shoumen daare?Translation:Kagome kagome, the bird in the cage,when will you come out?In the evening of the dawn,the crane and turtle slipped.Who stands right behind you now?Kagome Kagome is a Japanese children's game. One child is chosen as the oni (literally demon or ogre, but similar to the concept of "it" in tag) and sits blindfolded (or with their eyes covered). The other children join hands and walk in circles around the oni while singing the song for the game. When the song stops, the oni speaks aloud the name of the person behind him, and if he is correct, the person behind will exchange places with the oni.Higurashi Tewi is playing Kagome Kagome with her n (n is even) friends as the oni now. She peeps to know who is right in front of her. Knowing the order of the children in circle and assuming that they keep distance evenly, it's easy to derive who is right behind her.InputThere are multiple test cases. The first line of input is an integer T ≈ 100 indicating the number of test cases.The first line of each test case starts with an even number 1 ≤ n ≤ 100, followed by the name of the child who is right in front of Higurashi Tewi. The second line contains exactly n different names, listed in counterclockwise order. Name is an alphanumeric string whose length never exceeds 20. It's guaranteed that the child in front of Higurashi Tewi is always contained in the list exactly once.OutputFor each test case, output the name of the child who is right behind Higurashi Tewi.Sample Input32 AliceAlice Bob4 inuinu neko usagi kizune4 catdog cat rabbit foxSample OutputBobusagifoxReferences来源: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=118191#problem/F
//偶数N 所以是对称的#include <bits/stdc++.h>using namespace std;typedef struct{ char A[25],B[25];}P;P Pair[101];char Front[25];void Find(int N){ for(int i=1;i<=N/2;i++) if(!strcmp(Pair[i].A,Front)) {printf("%s\n",Pair[i].B);return;} for(int i=1;i<=N/2;i++) if(!strcmp(Pair[i].B,Front)) printf("%s\n",Pair[i].A);}int main(){ // freopen("F:\\test.txt","r",stdin); int T;cin>>T; for(int i=1,N;i<=T;i++) { scanf("%d %s",&N,Front); for(int i=1;i<=N/2;i++) scanf("%s",Pair[i].A); for(int i=1;i<=N/2;i++) scanf("%s",Pair[i].B); Find(N); } return 0;}
来源: http://acm.hust.edu.cn/vjudge/contest/viewSource.action?id=6159421
0 0
- ZOJ 3492 F - Kagome Kagome
- zoj 3492 Kagome Kagome
- zoj 3492 Kagome Kagome
- ZOJ 3492 Kagome Kagome
- zoj 3492 Kagome Kagome
- ZOJ 3492 Kagome Kagome
- ZOJ 3492Kagome Kagome
- ZOJ-3492 Kagome Kagome
- ZOJ 3492Kagome Kagome
- F Kagome Kagome
- ZOJ Problem Set - 3492||Kagome Kagome
- ZOJ 3488 Kagome Kagome
- Kagome Kagome
- ZOJ3492 Kagome Kagome
- ZOJ3492-Kagome Kagome
- The 8th Zhejiang Provincial Collegiate Programming Contest / F - Kagome Kagome
- 2014ACM集训13级PK赛2-Kagome Kagome
- The 8th Zhejiang Provincial Collegiate Programming Contest-> Kagome Kagome
- 第129课:Spark streaming源码经典解读系统之四:GobGenerator工作内幕源码解密
- test
- ZOJ 3498 L - Javabeans
- meta标签
- APP | 01- APP后端设计—基础:HTTP协议
- ZOJ 3492 F - Kagome Kagome
- 使用RecyclerView动画库需要注意的一些配置
- B - Conic Section 很水的判断题
- android自定义颜色进度条ColorSeekBar
- python科学计算_numpy_简单的多项式应用
- arm9 mini2440 10道面试题
- 算法导论第二十四章-单源最短路径-Cpp代码实现
- D - String Successor 字符串模拟题 耗时!
- 列表和字符串比较