所有栏目

杭州电子科技大学acm1280题我为什么错了?

作者:大学问答

runtime

error(access_violation)是运行时错误,非法访问内存,比如数组越界或者堆栈溢出。

看看题目要求:

input

contains

multiple

test

cases.

each

test

case

starts

with

a

number

n

(

0 <

n

<=

1000

) -- the

total

number

of balloons

distributed. the next n

lines

contain

one

color

each.

the

color

of

a

balloon

is

a

string

of

up

to

15

lower-case

letters.

a

test

case

with

n

=

0

terminates

the input

and

this

test

case

is

not

to

be

processed.

而你的程序:

a=(char

**)malloc(

10

*sizeof(char

*));

用个超过10个的case就越界了。

热点导航
教育资讯 知道问答 公考资讯 司法考试 建筑知识 工作范文 大学排名 报考专业 学习方法 句子美文 秒知回答 作业解答 精选答案 知途问学