UVa 10205 Stack 'em Up
来源:互联网 发布:ubuntu apache php 编辑:程序博客网 时间:2024/06/05 18:36
#include <stdio.h>#include <string.h>#define CARDNUM 52char Values[13][10] = {"2","3","4","5","6","7","8","9","10","Jack","Queen","King","Ace"};char Suits[4][10] = {"Clubs","Diamonds","Hearts","Spades"};void display(int card){ printf("%s of %s\n", Values[(card-1)%13],Suits[(card-1)/13]);}void shuffle(int cards[CARDNUM], int shuffle[CARDNUM]){ int temp[CARDNUM]; int i; for(i=0; i<CARDNUM; i++) temp[i] = cards[i]; for(i=0; i<CARDNUM; i++) cards[i] = temp[shuffle[i]-1];}int main(){ int cards[CARDNUM]; int shuffles[100][CARDNUM]; int apply; int cases, num, i, j; char temp[10]; scanf("%d",&cases); while(cases--) {for(i=0; i<CARDNUM; i++) cards[i] = i+1;scanf("%d",&num);for(i=0; i<num; i++) for(j=0; j<CARDNUM; j++) scanf("%d",&shuffles[i][j]);getchar();while(gets(temp)!=NULL && temp[0]!='\0'){sscanf(temp,"%d",&apply);shuffle(cards,shuffles[apply-1]);} for(i=0; i<CARDNUM; i++)display(cards[i]);if(cases) printf("\n");} return 0;}
0 0
- UVa 10205 Stack 'em Up
- uva 10205 Stack 'em Up
- UVA 10205 - Stack 'em Up
- UVa:10205 Stack 'em Up
- UVa 10205 Stack 'em Up
- UVa Problem Solution: 10205 - Stack 'em Up
- uva 10205 - Stack 'em Up(模拟)
- UVa 10205 Stack 'em Up (模拟)
- UVa Problem 10205 Stack ’em Up (完美洗牌术)
- UVA 10205 Problem E: Stack 'em Up(模拟)
- 110205 Stack 'em Up ( Stack em Up )
- UVA10205 - Stack 'em Up(模拟)
- (挑战编程_2_5)Stack 'em Up
- programming-challenges Stack 'em Up (110205) 题解
- 2.8.5 完美洗牌术 Stack 'em Up
- 31. Rack ‘Em Up
- PCB Stack-Up
- Protostar Stack Write Up
- paip.自适应网页设计 跟 响应式 设计的区别跟原理and实践总结
- Light OJ 1109 - False Ordering
- Android Activity类详解
- String构造器中originalValue.length>size 发生的情况
- 对象数组报错“空指针”:Exception in thread "main" java.lang.NullPointerException
- UVa 10205 Stack 'em Up
- CRichEditCtrl相关应用技巧收集
- ExtJS4 动态生成的grid导出为excel(纯前台)
- 机器学习(ML)中文视频教程
- ubuntu下安装oracle java8
- Light OJ 1045 Digits of Factorial(求位数)
- 算法的力量
- centOS下安装apache2.2
- HDU2544最短路 (Dijkstra求最短路)