Page 3 of 10
Runtime Error, 272
Posted: Tue Aug 08, 2006 12:19 am
by dontcry
Hi, I was wondering if someone could help me... it says I have a runtime error (Invalid memory reference) How could i solve it?
Thanks a lot!
Posted: Tue Aug 08, 2006 12:28 am
by dontcry
(I solved it already by changing the code a little bit... Thanks a lot anyway!

)
WA in 272
Posted: Fri Aug 25, 2006 1:42 pm
by law1009
excuse me! i do not know where is the bug.
please give me some tips. thanks a lot.
Code: Select all
#include <iostream>
using namespace std;
int main(){
char str[2000];
char k=1;
while(cin){
cin.getline(str, 2000);
for(int i=0; str[i]!= '\0' ; i++){
if(str[i]=='"'){
if(k%2==1) cout<<"``";
else cout<<"''";
k++;
}
else cout<<str[i];
}
cout<<endl;
}
return 0;
}
[/code]
Posted: Fri Aug 25, 2006 2:57 pm
by Bluefin
I do not understand why you write this:
it should be like this:
modify it and you'll get ACC. I have already tried it and the program got ACC immediately !!

Good Luck !!
Posted: Sun Aug 27, 2006 2:51 pm
by law1009
Bluefin wrote:I do not understand why you write this:
it should be like this:
modify it and you'll get ACC. I have already tried it and the program got ACC immediately !!

Good Luck !!
Thank you very much! it could be accepted.
and may i have another question?
"Warning: Your program would get a Presentation Error in a true contest.
The 24-hours judge interpretes it as an "Accepted" problem.
"
what did it mean?
Posted: Sun Aug 27, 2006 3:16 pm
by Bluefin
Thank you very much! it could be accepted.
and may i have another question?
"Warning: Your program would get a Presentation Error in a true contest.
The 24-hours judge interpretes it as an "Accepted" problem.
"
what did it mean?
You get PE for this problem. It means your answer is correct, but your format has some small errors !!
Your Code output:
Code: Select all
``To be or not to be,'' quoth the Bard, ``that
is the question''.
The programming contestant replied: ``I must disagree.
To `C' or not to `C', that is The Question!''
--------> there is a blank line, please delete it !!
You have to modify your cin to avoid this problem
Your code:
Code: Select all
while(cin){
cin.getline(str, 2000);
it should be
Hope you can get complete ACC!! Good luck!!

plz help me(272 TEX QUOTES)
Posted: Sun Sep 03, 2006 11:42 am
by ishtiaq ahmed
i got WA. but why? my code is given bellow
ha ha ha!
Posted: Sun Sep 03, 2006 12:38 pm
by newton
here are some input and output
input:
Code: Select all
"I am mr newton". "are you ish?
n" nothing' to be worried" " ".
output:
Code: Select all
``i am mr newton''. ``are you ish?
n'' nothing' to be worried`` '' ``.
i think the output results will help u to find the problem.
check if u r confused about the sign '' and ``
newton.......................................simply the most
272 - TEX Quotes
Posted: Thu Nov 16, 2006 7:22 pm
by Rushow
I think this is the most easiest, but I don't khow why getting WA.
Plz help me to debug this. Thax in advance.
/* p272 */
/* Tex qoutes */
#include<stdio.h>
#include<string.h>
void main()
{
int i,c;
char r[2000];
while(gets(r))
{
c=1;
for(i=0;r!='\0';i++)
{
if(r=='"'&&c%2==0)
{
printf("''");
c++;
}
else if(r=='"'&&c%2!=0)
{
printf("``");
c++;
}
else
printf("%c",r);
}
}
}
Posted: Thu Nov 16, 2006 8:29 pm
by seulkiro
Hey Rushow..
Does your program print newline for each line? When I tried to compile your code, I got an error saying that main() needs return statement. And when I fixed it and run it, output your program generated didn't have newlines at all for each line.
Another thing is that quotes can be broken by lines.
Hope this helps.
272 OLE
Posted: Sun Jul 29, 2007 4:16 pm
by starrynight
excuse me , can't anyone tell me,why i got an OLE ?
and I don't know why I can't end this program when I enter"ctrl + z"
ah .. sorry for my poor English
this is my code:
Code: Select all
#include <stdio.h>
#include <string.h>
int main()
{
int i;
int k;
int count;
char sl[2000];
while( gets(sl) != EOF )
{
k = strlen(sl);
count = 0;
for(i=0;i<k;i++)
{
if((sl[i] == '"') && (count%2 == 0) )
{
printf("``");
count++;
}
else if((sl[i] == '"') && (count%2 != 0) )
{
printf("''");
count++;
}
else
{
printf("%c",sl[i]);
}
}
printf("\n");
}
return 0;
}
Posted: Sun Jul 29, 2007 4:28 pm
by helloneo
gets() returns NULL instead of EOF ..

272..WA
Posted: Mon Jul 30, 2007 11:29 am
by starrynight
helloneo
thank you very much.
but this time I got WA ...
can anyone tell me why?
thanks!
this is my code:
Code: Select all
#include <stdio.h>
#include <string.h>
int main()
{
int i;
int k;
int count;
char sl[2000];
while( gets(sl) != NULL )
{
k = strlen(sl);
count = 0;
for(i=0;i<k;i++)
{
if((sl[i] == '"') && (count%2 == 0) )
{
printf("``");
count++;
}
else if((sl[i] == '"') && (count%2 != 0) )
{
printf("''");
count++;
}
else
{
printf("%c",sl[i]);
}
}
printf("\n");
}
return 0;
}
I am getting WA....
Posted: Sun Mar 02, 2008 7:24 am
by Obaida
Some one please help me..... I tried my best to do all the task.... but it give me WA.....
Please help me.....
Can't Encode it...
Posted: Sun Mar 02, 2008 8:38 am
by Obaida
Some one please help me Am in helpless position.... I tried my best to do it.....