(挑战编程_2_5)Stack 'em Up
2013-05-30 10:24
417 查看
http://www.programming-challenges.com/pg.php?page=downloadproblem&probid=110205&format=html
#include <iostream> #include <string> #include <map> #include <stdio.h> #include <cstring> #include <stdlib.h> using namespace std; int data[110][60]; int result[53]; int temp[53]; int main() { int n; //#ifndef ONLINE_JUDGE // freopen("C:/Users/cao/Desktop/算法/要看的书/算法/2挑战编程/input/1.inp", "r", stdin); // freopen("C:/Users/cao/Desktop/算法/要看的书/算法/2挑战编程/input/3.outp", "w", stdout); //#endif cin >> n; while (n--) { int k; cin >> k; int i, j; for (i = 1; i <= k; i++) { for (j = 1; j <= 52; j++) { cin >> data[i][j]; } } getchar(); string input; for (i = 1; i <= 52; i++) { result[i] = i; } while (getline(cin, input)) { if (input == "") break; int t = atoi(input.c_str()); for (i = 1; i <= 52; i++) { temp[i] = result[data[t][i]]; } memcpy(result, temp, sizeof(result)); input = ""; } for (i = 1; i <= 52; i++) { int row, column; row = (result[i] - 1) / 13; column = (result[i] - 1) % 13; if (column >= 0 && column <= 8) { cout << column + 2; } else { switch (column) { case 9: cout << "Jack"; break; case 10: cout << "Queen"; break; case 11: cout << "King"; break; case 12: cout << "Ace"; break; } } cout << " of "; switch (row) { case 0: cout << "Clubs" << endl; break; case 1: cout << "Diamonds" << endl; break; case 2: cout << "Hearts" << endl; break; case 3: cout << "Spades" << endl; break; } } if (n != 0) { cout << endl; } } return 0; }
相关文章推荐
- programming-challenges Stack 'em Up (110205) 题解
- UVa 10205 Stack 'em Up (模拟)
- UVA10205 - Stack 'em Up(模拟)
- (挑战编程_4_1)Vito's Family
- 爱学习,爱编程,爱咖啡可乐 爱挑战,爱钻研,爱打游戏 爱晚起,也爱工作到深夜 我擅长技术,崇尚简单和懒惰 我神秘而孤僻,沉默而爱憎分明 Don't Panic! I'm a programmer
- Beat 'Em Up Game Starter Kit (横版格斗游戏) cocos2d-x游戏源代码
- Beat 'Em Up Game Starter Kit (横版格斗游戏) cocos2d-x游戏源码
- (挑战编程_3_2)Where's Waldorf?
- Beat 'Em Up Game Starter Kit (横版格斗游戏) cocos2d-x游戏源码
- Use 'mysqld --thread_stack=#' to specify a bigger stack.
- 关于android编程中遇到的Could not find class 'com.swetake.util.Qrcode错误的原因及解决办法
- VS2008中Run-Time Check Failure #2 - Stack around the variable 'xxx' was corrupted 错误解决方法
- New Apache Project 'Drill' Aims to Speed Up Hadoop Queries
- Run-Time Check Failure #2 - Stack around the variable 'XX‘ was corrupted 解决方法
- Cannot set up guest memory 'android_arm': Invalid argument 解决方法
- ttyUSB not showing up, modprobe unknown parameter 'vendor' & 'product'
- Track'em Down铪铪铪铪铪铪铪
- Track'em Down铪铪铪铪铪铪铪
- svn提交出错提示:svn locked; try performing 'cleanup'的解决方法
- SVN UP 命令出现错误:Can't convert string from 'UTF-8' to native encoding: