#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;
}
CgojaW5jbHVkZSA8c3RkaW8uaD4KI2luY2x1ZGUgPHN0ZGxpYi5oPgojaW5jbHVkZSA8dGltZS5oPiAvL+S5seaVsOOBrueUn+aIkOOBruOBn+OCgQoKdHlwZWRlZiBzdHJ1Y3QgewogICAgY2hhciBuYVs2NF07CiAgICBpbnQgc3R0c1s2XTsKfSBNb25zdGVyOwoKTW9uc3RlciBjcmVNb25zdGVyKCl7CiAgICBpbnQgaSxrOwogICAgTW9uc3RlciB0bXA7CiAgICBrID0gcmFuZCgpJTgrNDsKICAgIGludCBhID0gJ2EnICsgcmFuZCgpJTI2OwogICAgZm9yKGk9MDtpPGs7aSsrKSB0bXAubmFbaV0gPSAnYScgKyByYW5kKCklMjY7CiAgICB0bXAubmFba10gPSAnXDAnOwogICAgZm9yKGk9MDtpPDY7aSsrKSB0bXAuc3R0c1tpXSA9IHJhbmQoKSUyNTUrMTsKICAgIHJldHVybiB0bXA7Cn0KCnZvaWQgcHJpTW9uc3RlcihNb25zdGVyIG0pewogICAgcHJpbnRmKCIlMTJzICA6ICIsbS5uYSk7CiAgICBmb3IoaW50IGk9MDtpPDY7aSsrKQogICAgICAgIHByaW50ZigiJTNkICIsbS5zdHRzW2ldK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