#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(n
* sizeof(Monster
));
//以下はいじらなくてOK
if(monsters == NULL){
return 0;
}
for(i=0;i<n;i++){
monsters[i] = creMonster();
priMonster(monsters[i]);
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHRpbWUuaD4gLy8g5Lmx5pWw44Gu55Sf5oiQ44Gu44Gf44KBCgp0eXBlZGVmIHN0cnVjdCB7CiAgICBjaGFyIG5hWzY0XTsKICAgIGludCBzdHRzWzZdOwp9IE1vbnN0ZXI7CgpNb25zdGVyIGNyZU1vbnN0ZXIoKSB7CiAgICBpbnQgaSwgazsKICAgIE1vbnN0ZXIgdG1wOwogICAgayA9IHJhbmQoKSAlIDggKyA0OyAKICAgIGZvciAoaSA9IDA7IGkgPCBrOyBpKyspIHsKICAgICAgICB0bXAubmFbaV0gPSAnYScgKyByYW5kKCkgJSAyNjsKICAgIH0KICAgIHRtcC5uYVtrXSA9ICdcMCc7IAoKICAgIGZvciAoaSA9IDA7IGkgPCA2OyBpKyspIHsKICAgICAgICB0bXAuc3R0c1tpXSA9IHJhbmQoKSAlIDI1NSArIDE7IAogICAgfQogICAgcmV0dXJuIHRtcDsKfQoKdm9pZCBwcmlNb25zdGVyKE1vbnN0ZXIgbSkgewogICAgcHJpbnRmKCIlMTJzICA6ICIsIG0ubmEpOw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