#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 r;
int used_card[52] = {0};
for(int i=0; i<4; i++)
{
for(int j=0; j<13; j++)
{
do
{
}
while (used_card[r]==1);
used_card[r] = 1;
deck[i][j] = r;
}
}
}
void print_trump(int deck[][13],int *m,int *N)
{
int n = 1;
int mark,num;
for(int i=0; i<4; i++)
{
for(int j=0; j<13; j++)
{
mark = deck[i][j]/13;
num = deck[i][j]%13;
printf("%d枚目:%d-%d\n",n
,m
[mark
],N
[num
]); n++;
}
}
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGU8c3RkbGliLmg+CiNpbmNsdWRlPHRpbWUuaD4KCnZvaWQgc2h1ZmZsZShpbnQgW11bMTNdKTsKdm9pZCBwcmludF90cnVtcChpbnQgW11bMTNdLGludCosaW50Kik7CgppbnQgbWFpbih2b2lkKQp7CiAgICBpbnQgZGVja1s0XVsxM10gPSB7MH07CiAgICBpbnQgdHJ1bXBfbWFya1s0XSA9IHsxMDAsMjAwLDMwMCw0MDB9OwogICAgaW50IHRydW1wX251bVsxM10gPSB7MSwyLDMsNCw1LDYsNyw4LDksMTAsMTEsMTIsMTN9OwoKICAgIHNyYW5kKHRpbWUoTlVMTCkpOwogICAgCiAgICBzaHVmZmxlKGRlY2spOwogICAgcHJpbnRfdHJ1bXAoZGVjayx0cnVtcF9tYXJrLHRydW1wX251bSk7CgogICAgcmV0dXJuIDA7Cn0KCnZvaWQgc2h1ZmZsZShpbnQgZGVja1tdWzEzXSkKeyAgIAogICAgLy/jg4jjg6njg7Pjg5fjga7poIbnlaoKICAgIGludCByOwogICAgaW50IHVzZWRfY2FyZFs1Ml0gPSB7MH07CiAgICAKICAgIGZvcihpbnQgaT0wOyBpPDQ7IGkrKykKICAgIHsKICAgICAgICBmb3IoaW50IGo9MDsgajwxMzsgaisrKQogICAgICAgIHsKICAgICAgICAgICAgZG8gIAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICByID0gcmFuZCgpJTUyOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHdoaWxlICh1c2VkX2NhcmRbcl09PTEpOwoKICAgICAgICAgICAgdXNlZF9jYXJkW3JdID0gMTsKICAgICAgICAgICAgZGVja1tpXVtqXSA9IHI7ICAgICAgICAgICAgICAKICAgICAgICB9CiAgICB9Cn0KCnZvaWQgcHJpbnRfdHJ1bXAoaW50IGRlY2tbXVsxM10saW50ICptLGludCAqTikKewogICAgaW50IG4gPSAxOwogICAgaW50IG1hcmssbnVtOwoKICAgIGZvcihpbnQgaT0wOyBpPDQ7IGkrKykKICAgIHsKICAgICAgICBmb3IoaW50IGo9MDsgajwxMzsgaisrKQogICAgICAgIHsKICAgICAgICAgICAgbWFyayA9IGRlY2tbaV1bal0vMTM7CiAgICAgICAgICAgIG51bSA9IGRlY2tbaV1bal0lMTM7CiAgICAgICAgICAgIAogICAgICAgICAgICBwcmludGYoIiVk5p6a55uuOiVkLSVkXG4iLG4sbVttYXJrXSxOW251bV0pOyAgCiAgICAgICAgICAgIG4rKzsgICAgICAgICAgICAgICAKICAgICAgICB9CiAgICB9Cn0KCgo=