为什么我提交的时候都显示runtime error 91(ACCESS_VIOLATION)

杭电acm1003为什么都过不了,显示Runtime Error(ACCESS_VIOLATION)_百度知道
杭电acm1003为什么都过不了,显示Runtime Error(ACCESS_VIOLATION)
you should output two lines,,Case #,m,y,x,
if(sum&gt,Sample Input25 6 -1 5 4 -77 0 6 -1 1 -6 7 -5 Sample OutputCase 1,int main (void){
int n, given (6,&m),=N&lt,OutputFor each test case,,-7),
return 0,-1,&quot,a[n],p, then N integers followed(all the integers are between -1000 and 1000),i, your job is to calculate the max sum of a sub-sequence,
while(scanf(&quot,n%d %d %d&#92,j++)
scanf(&quot,h&gt,
printf(&quot,p&lt,a[3],哪里不对,n&quot, the max sum in this sequence is 6 + (-1) + 5 + 4 = 14,i&lt,),,y=q, the Max Sum in the sequence,&#92,, # means the number of the test case,sum,n&quot,
for(j=0,%d&quot,,,%d&quot,y+1),InputThe first line of the input contains an integer T(1&lt, each line starts with a number N(1&lt,x+1,=T&lt,,a[2],q&lt, The second line contains three integers,q, Then T lines follow,max,m,&#92,q++)
sum+=a[q],i+1, the start position of the sub-sequence,i++)
max=a[0], For example,&a[j]),,,n,=100000),Case %d, If there are more than one result,7 1 6我的代码是#include&lt,14 1 4Case 2, output the first one,,5,
scanf(&quot,
printf(&quot,max)
max=sum,m,
for(q=p, The first line is &quot,#define LEN 5000int a[LEN],j, Output a blank line between two cases,%d&quot,m,p++)
sum=0,Given a sequence a[1],j&lt,,max,=20) which means the number of test cases,}我开了很大的数组还是不行的啊, the end position of the sub-sequence,
x=p,stdio,&n)!=EOF)
for(p=0,4,
提问者采纳
题目范围是 100000,所以要开 100000的数组,数组开的不够大,
我试了没用啊,直接time limited
TLE 是你的算法有问题,你两重for 合起来复杂度是 O(n^2
n=100000平方是多少你自己算一下,肯定要超时的
提问者评价
恩,那该用什么算法啊?给个提示哦~~~
其他类似问题
runtime的相关知识
其他1条回答
没有赋初值,所以会Runtime Error还有就是 while的循环结束条件不足,如果到最后 m还是没有==0你就错了这是ac的代码#include,
mm是什么? 我sum不是有初值0了啊?循环结束条件题目没要求 的啊?
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁杭电ACM1106 为什么老是Runtime Error (ACCESS_VIOLATION)_百度知道
杭电ACM1106 为什么老是Runtime Error (ACCESS_VIOLATION)
=j,h&quot,i++)
for(k=i,i,k++)
if(izhi[i]&gt,j=0,
if(i!=0&&chsr[i+1]!=&#39,0&#39,}return 0,
}for(i=0,izhi[110]={0},i++)
printf(&quot,,5&#39,k++){}for(i=k,i++){
if(chsr[i]!=&#39,,0&#39,for(k=0,izhi[k])
temp=izhi[i],%d &quot,k&lt,
izhi[i]=izhi[k],temp=0,
izhi[k]=temp,
}}for(i=0,(j),stdio,k,while(gets(chsr)!=NULL){int n,y,5&#39,&#92,)
izhi[j]=izhi[j]*10+(chsr[i]-&#39,&&i!=(n-1))
j++,string,),h&gt,chsr[i]!=&#39,5&#39,=j,n=strlen(chsr),#include &quot,&#92,#include&lt,
printf(&quot,i&lt,),izhi[i]),i&lt,j,,int main(){char chsr[1010],},chsr[k]==&#39,n&quot,temp,
我有更好的答案
C++了解不深,for(k=0,开到1001吧,那5之前的数无论是什么都会被忽略,只开110会不会小了一点,只能说和你一起猜为什么会错吧。while(gets(chsr)!=NULL)这句如果改成while(gets(chsr))会怎样,chsr[k]==&#39,今天刚用JAVA解出来,5&#39,反正不是占自己电脑的空间,k++){}这段是找出第一个5,有的AC代码是 !=EOF 的,我看网上很多都没不等于NULL的,,而且大部分都是讨论C的,相比之下JAVA出问题要麻烦多了参考一下别人的答案如果改了上面的东西都没帮助,好吧,我只是酱油路过的。祝你能尽快AC咯~,都试一下看是不是这些问题izhi[110]={0},电脑没装C++不能帮你调试了那个问题下有很多人在讨论了,
其他类似问题
runtime的相关知识
等待您来回答
您可能关注的推广回答者:
下载知道APP
随时随地咨询
出门在外也不愁请问以下杭电acm 1009 代码为什么老显示Runtime Error (ACCESS_VIOLATION)啊?要怎么改?_百度知道
请问以下杭电acm 1009 代码为什么老显示Runtime Error (ACCESS_VIOLATION)啊?要怎么改?
#include&stdio.h&int main(){ int n,j[1000],c[1000],m,i,double s=0.0,per[1000],max=0.0, while(scanf(&%d%d&,&m,&n),(m!=-1&&n!=-1)) {
rem=(double)m;
for(i=0;i&n;i++)
{ scanf(&%d%d&,&j[i],&c[i]);
per[i]=(double)j[i]/c[i];
while(rem&0)
for(i=0;i&n;i++)
if(per[i]&max)
{ max=per[i];
per[mm]=0.0;max=0.0;if(rem-c[mm]&=0)
rem-=c[mm]; s+=j[mm];
s+=rem*j[mm]/c[mm];rem=0;
printf(&%.3lf\n&,s);
s=0.0; } return 0;}
提问者采纳
没有赋初值,所以会Runtime Error还有就是 while的循环结束条件不足,如果到最后 m还是没有==0你就错了这是ac的代码#include&stdio.h&int main(){ int n,j[1000],c[1000],m,i,double s=0.0,per[1000],max=0.0, while(scanf(&%d%d&,&m,&n),(m!=-1&&n!=-1)) {
rem=(double)m;
for(i=0;i&n;i++)
{ scanf(&%d%d&,&j[i],&c[i]);
per[i]=(double)j[i]/c[i];
while(rem&0&&k&n)//定义一个k来记录次数
mm=0;k++;//mm赋初值
for(i=0;i&n;i++)
if(per[i]&max)
{ max=per[i];
per[mm]=0.0;max=0.0;if(rem-c[mm]&=0)
rem-=c[mm]; s+=j[mm];
s+=rem*j[mm]/c[mm];rem=0;
printf(&%.3lf\n&,s);
s=0.0; } return 0;}
提问者评价
嗯嗯晓得了~多谢多谢哈^ ^
其他类似问题
acm的相关知识
其他2条回答
这是我1009的代码
和你分享一下
就是一个小小的贪心 注意过程#include&stdio.h&#include&algorithm&typedef struct node{}mat a[1002];int cmp(mat a,mat b){
return a.dj&b.
}int main(){
while(scanf(&%lf%d&,&m,&n))
if(m==-1&&n==-1)
for(i=0;i&n;i++)
scanf(&%lf%lf&,&a[i].gs,&a[i].jg);
a[i].dj=a[i].gs/a[i].
sort(a,a+n,cmp);
while(m!=0.0)
if(a[i].jg&=m)
count+=a[i].dj*m;
count+=a[i].
printf(&%.3lf\n&,count);
return 0;}
不用客气~~
#include&stdio.h&int main(){ int n,j[1000],c[1000],m,i, double s=0.0,per[1000],max=0.0, while(scanf(&%d%d&,&m,&n),(m!=-1&&n!=-1)) {
rem=(double)m;
for(i=0;i&n;i++)
scanf(&%d%d&,&j[i],&c[i]);
per[i]=(double)j[i]/c[i];
per[i]=1e12;
while(rem&=0)
for(i=0;i&n;i++)
if(per[i]&max)
max=per[i];
per[mm]=-2;
if(rem-c[mm]&=0)
rem-=c[mm];
s+=rem*j[mm]/c[mm];
printf(&%.3lf\n&,s);
s=0.0; } return 0;}
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁而在HD1203上总是提示Runtime Error(ACCESS_VIOLATION)。愿闻大家指教。谢谢了_百度知道
提问者采纳
Access Violation(非法访问),General Protection Fault(一般保护性错误)或者Invalid Page Fault(无效页面错误),虽然说法不一样,但本质上总是由同一种错误引起的。Access Violation常常在计算机用户运行的程序试图存取未被指定使用的存储区时遇到。 Access violation at address &十六进制值& in module &应用程序名& Read of address &十六进制值& “Access violation at address .Read of adress .意思是:在地址
存取违反,禁止对地址的读取 出现access violation at address . read of address .原因是:没有运行服务端软件,所以客户机会提示&Access violation at address , read of address 0000000&,开启服务端程序或检查网线即可解决。 另外,可能出现这个问题的原因是因为你是在WINRAR的窗口中运行程序,而程序又找不到主要文件引起的。 解决方法:)~~ 尝试用兼容方式运行该程序.右键点击图标——属性——兼容型——选中“以兼容方式运行该程序”——下面的选框中可以选择以95、98、NT4.0或2000模式来运行。推荐选择98试试看。
其他类似问题
runtime的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁第一次参加这个比赛Runtime Error (ACCESS_VIOLATION)_百度之星吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
Judge Status:Runtime Error(ACCESS_VIOLATION)这个是什么情况?然后修改之后。自己测试过很多数据,然后又用测试过了,和输出要求一致,然后出现:Wrong Answer。第一次参加这种网上的比赛,求解答哈哈,如果是程序出错我在回去修改下bug
同样的问题
不知道怎么修改!!!!
我的是Wrong Answer。。。。
登录百度帐号我的游戏推荐游戏
后查看最近玩过的游戏
为兴趣而生,贴吧更懂你。或}

我要回帖

更多关于 runtime error 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信