#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void shuffle(int [][13]);
void print_trump(int [][13], int*, int*);
int main(void) {
int deck[4][13] = {0};
int trump_mark[4] = {100,200,300,400};
int trump_num[13] = {1,2,3,4,5,6,7,8,9,10,11,12,13};
shuffle(deck);
print_trump(deck, trump_mark, trump_num);
return 0;
}
void shuffle(int deck[][13]) {
int shu[52];
for (int i=0; i<=51; i++) shu[i] = i+1;
int a= 52;
while (a>0) {
int temp = shu[a-1];
shu[a-1] = shu[r];
shu[r] = temp;
--a;
}
int c = 0;
for (int i=0; i<=3; i++) {
for (int j=0; j<13; j++) {
deck[i][j] = shu[c++];
}
}
}
void print_trump(int deck[][13], int mark[], int num[]) {
for (int n=1; n<=52; n++) {
for (int i=0; i<=3; i++) {
for (int j=0; j<13; j++) {
if (n
== deck
[i
][j
]) printf("%d:%d-%d\n", n
, mark
[i
], num
[j
]); }
}
}
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHRpbWUuaD4KCnZvaWQgc2h1ZmZsZShpbnQgW11bMTNdKTsKdm9pZCBwcmludF90cnVtcChpbnQgW11bMTNdLCBpbnQqLCBpbnQqKTsKCmludCBtYWluKHZvaWQpIHsKICAgIGludCBkZWNrWzRdWzEzXSA9IHswfTsKICAgIGludCB0cnVtcF9tYXJrWzRdID0gezEwMCwyMDAsMzAwLDQwMH07CiAgICBpbnQgdHJ1bXBfbnVtWzEzXSA9IHsxLDIsMyw0LDUsNiw3LDgsOSwxMCwxMSwxMiwxM307CgogICAgc2h1ZmZsZShkZWNrKTsKCiAgICBwcmludF90cnVtcChkZWNrLCB0cnVtcF9tYXJrLCB0cnVtcF9udW0pOwoKICAgIHJldHVybiAwOwp9Cgp2b2lkIHNodWZmbGUoaW50IGRlY2tbXVsxM10pIHsKICAgIGludCBzaHVbNTJdOwogICAgZm9yIChpbnQgaT0wOyBpPD01MTsgaSsrKSBzaHVbaV0gPSBpKzE7CgogICAgc3JhbmQodGltZShOVUxMKSk7CiAgICBpbnQgYT0gNTI7IAogICAgd2hpbGUgKGE+MCkgewogICAgICAgIGludCByID0gcmFuZCgpJWE7CiAgICAgICAgaW50IHRlbXAgPSBzaHVbYS0xXTsKICAgICAgICBzaHVbYS0xXSA9IHNodVtyXTsKICAgICAgICBzaHVbcl0gPSB0ZW1wOwogICAgICAgIC0tYTsKICAgIH0KCiAgICBpbnQgYyA9IDA7CiAgICBmb3IgKGludCBpPTA7IGk8PTM7IGkrKykgewogICAgICAgIGZvciAoaW50IGo9MDsgajwxMzsgaisrKSB7CiAgICAgICAgICAgIGRlY2tbaV1bal0gPSBzaHVbYysrXTsKICAgICAgICB9CiAgICB9Cn0KCnZvaWQgcHJpbnRfdHJ1bXAoaW50IGRlY2tbXVsxM10sIGludCBtYXJrW10sIGludCBudW1bXSkgewogICAgZm9yIChpbnQgbj0xOyBuPD01MjsgbisrKSB7CiAgICAgICAgZm9yIChpbnQgaT0wOyBpPD0zOyBpKyspIHsKICAgICAgICAgICAgZm9yIChpbnQgaj0wOyBqPDEzOyBqKyspIHsKICAgICAgICAgICAgICAgIGlmIChuID09IGRlY2tbaV1bal0pIHByaW50ZigiJWQ6JWQtJWRcbiIsIG4sIG1hcmtbaV0sIG51bVtqXSk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9ICAKfQ==