#include <stdio.h>
#include <stdlib.h>
#include <time.h> //乱数の生成のため
typedef struct {
char na[64];
int stts[6];
} Monster;
Monster creMonster(){
int i,k;
Monster tmp;
for(i
=0;i
<k
;i
++) tmp.
na[i
] = 'a' + rand()%26; tmp.na[k] = '\0';
for(i
=0;i
<6;i
++) tmp.
stts[i
] = rand()%255+1; return tmp;
}
void priMonster(Monster m){
for(int i=0;i<6;i++)
}
int main(){
srand((unsigned)time(NULL
)); //乱数を生成する時のおまじない int i, n;
Monster *monsters;
//ここに1行で monstersにn体のモンスターの領域を確保する
monsters
=(Monster
*)malloc(sizeof(Monster
)*n
);
//以下はいじらなくてOK
if(monsters == NULL){
return 0;
}
for(i=0;i<n;i++){
monsters[i] = creMonster();
priMonster(monsters[i]);
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHRpbWUuaD4gLy/kubHmlbDjga7nlJ/miJDjga7jgZ/jgoEKIAp0eXBlZGVmIHN0cnVjdCB7CiAgICBjaGFyIG5hWzY0XTsKICAgIGludCBzdHRzWzZdOwp9IE1vbnN0ZXI7CiAKTW9uc3RlciBjcmVNb25zdGVyKCl7CiAgICBpbnQgaSxrOwogICAgTW9uc3RlciB0bXA7CiAgICBrID0gcmFuZCgpJTgrNDsKICAgIGludCBhID0gJ2EnICsgcmFuZCgpJTI2OwogICAgZm9yKGk9MDtpPGs7aSsrKSB0bXAubmFbaV0gPSAnYScgKyByYW5kKCklMjY7CiAgICB0bXAubmFba10gPSAnXDAnOwogICAgZm9yKGk9MDtpPDY7aSsrKSB0bXAuc3R0c1tpXSA9IHJhbmQoKSUyNTUrMTsKICAgIHJldHVybiB0bXA7Cn0KIAp2b2lkIHByaU1vbnN0ZXIoTW9uc3RlciBtKXsKICAgIHByaW50ZigiJTEycyAgOiAiLG0ubmEpOwogICAgZm9yKGludCBpPTA7aTw2O2krKykKICAgICAgICBwcmludGYoIiUzZCAiLG0uc3R0c1tpXSk7CiAgICBwcmludGYoIlxuIik7Cn0KIAppbnQgbWFpbigpewogICAgc3JhbmQoKHVuc2lnbmVkKXRpbWUoTlVMTCkpOyAvL+S5seaVsOOCkueUn+aIkOOBmeOCi+aZguOBruOBiuOBvuOBmOOBquOBhAogICAgaW50IGksIG47CiAgICBNb25zdGVyICptb25zdGVyczsKICAgIHNjYW5mKCIlZCIsJm4pOwogICAgLy/jgZPjgZPjgavvvJHooYzjgacgbW9uc3RlcnPjgatu5L2T44Gu44Oi44Oz44K544K/44O844Gu6aCY5Z+f44KS56K65L+d44GZ44KLCgltb25zdGVycz0oTW9uc3RlciAqKW1hbGxvYyhzaXplb2YoTW9uc3Rlcikqbik7CiAKICAgIC8v5Lul5LiL44Gv44GE44GY44KJ44Gq44GP44Gm77yv77yrCiAgICBpZihtb25zdGVycyA9PSBOVUxMKXsKICAgICAgICBwcmludGYoIkVSUk9SXG4iKTsKICAgICAgICByZXR1cm4gMDsKICAgIH0KICAgIGZvcihpPTA7aTxuO2krKyl7CiAgICAgICAgbW9uc3RlcnNbaV0gPSBjcmVNb25zdGVyKCk7CiAgICAgICAgcHJpbnRmKCIlMDNkICAiLGkrMSk7CiAgICAgICAgcHJpTW9uc3Rlcihtb25zdGVyc1tpXSk7CiAgICB9CiAgICBmcmVlKG1vbnN0ZXJzKTsKICAgIHJldHVybiAwOwp9