458 - The Decoder
Moderator: Board moderators
-
- New poster
- Posts: 47
- Joined: Sun Nov 27, 2005 12:43 pm
-
- Learning poster
- Posts: 98
- Joined: Sat Jan 21, 2006 12:45 pm
- Location: Busan,Corea(Republic of)
Maybe;
Maybe there is an error in array size
Archaan
CAN YOU BEAT ME?
http://acm.uva.es/problemset/usersjudge.php?user=19788
AND,
http://acm.uva.es/problemset/submit.php
http://online-judge.uva.es/problemset/submit.php
SUBMIT AND GET AC!!!
CAN YOU BEAT ME?
http://acm.uva.es/problemset/usersjudge.php?user=19788
AND,
http://acm.uva.es/problemset/submit.php
http://online-judge.uva.es/problemset/submit.php
SUBMIT AND GET AC!!!
simplest code
Code: Select all
#include<stdio.h>
int main()
{
char ch, sub;
while( (ch = getchar()) != EOF )
{
if(ch == '\n') printf("\n");
else
printf("%c", ch-7);
}
return 0;
}

Regards,
[]'s
Andre
[]'s
Andre
494-why output limit exeeded?& 458-Time limit execeeded?
Hi,
this is my mail. Anyone plzzzz help me!
code for 494 :
#include<stdio.h>
#include<ctype.h>
void main()
{
int word,i;
char str[10000];
while(1)
{
word=0;
gets(str);
if(str[0]!='\0')
{
if(isalpha(str[0]))
word++;
for(i=0;str!='\0';i++)
{
if(str==' '||str=='\t')
if(isalpha(str[i+1]))
word++;
}
}
printf("%d\n",word);
}
}
Idonno why i am getting Output Limit Exceeded!
plz anyone,do let me know!!!
458 is an easy one but i am getting TLE!(why??)
code for 458:#include<stdio.h>
void main()
{
char str[100000];
int i;
while(1)
{
gets(str);
for(i=0;str!='\0';i++)
{
str=str-7;
printf("%c",str);
}
}
}
please someone HELP me! i just got stuck'n here...
[/u]
this is my mail. Anyone plzzzz help me!
code for 494 :
#include<stdio.h>
#include<ctype.h>
void main()
{
int word,i;
char str[10000];
while(1)
{
word=0;
gets(str);
if(str[0]!='\0')
{
if(isalpha(str[0]))
word++;
for(i=0;str!='\0';i++)
{
if(str==' '||str=='\t')
if(isalpha(str[i+1]))
word++;
}
}
printf("%d\n",word);
}
}
Idonno why i am getting Output Limit Exceeded!
plz anyone,do let me know!!!

458 is an easy one but i am getting TLE!(why??)
code for 458:#include<stdio.h>
void main()
{
char str[100000];
int i;
while(1)
{
gets(str);
for(i=0;str!='\0';i++)
{
str=str-7;
printf("%c",str);
}
}
}
please someone HELP me! i just got stuck'n here...

[/u]
Important!!!
-
- Learning poster
- Posts: 99
- Joined: Sun Apr 06, 2003 5:53 am
- Location: Dhaka, Bangladesh
- Contact:
There is no breaking condition in your "while" loop ... 
try some thing like
while(1) defines an infinite loop ... while(gets(str)) will break when it reaches End of Input File

try some thing like
Code: Select all
while(gets(str))
{
......
......
}
Where's the "Any" key?
-
- New poster
- Posts: 1
- Joined: Thu Jan 18, 2007 10:09 am
I don't understand why it can't run Q458
#include<stdio.h>
#include<stdlib.h>
int main()
{
char c;
char *Output;
int i=0,j;
printf("please input words\t");
Output=(char*)malloc(100*sizeof(char));
while((c=getchar())!='\n')
{
Output=c-'J'+'C';
i++;
}
for(j=0;j<i;j++)
printf("%c",Output[j]);
printf("\n");
free(Output);
return 0;
}
#include<stdlib.h>
int main()
{
char c;
char *Output;
int i=0,j;
printf("please input words\t");
Output=(char*)malloc(100*sizeof(char));
while((c=getchar())!='\n')
{
Output=c-'J'+'C';
i++;
}
for(j=0;j<i;j++)
printf("%c",Output[j]);
printf("\n");
free(Output);
return 0;
}
-
- Learning poster
- Posts: 62
- Joined: Sun Jul 09, 2006 8:31 am
- Location: University of Dhaka
- Contact:
458..output limit exceeded???
#include <iostream>
using namespace std;
int main()
{
char ch;
cin.get(ch);
while (ch != '\0')
{
if (ch == 10)
cout << ch;
else
cout << (static_cast<char>(ch-7));
cin.get(ch);
}
cout << '\n';
return 0;
}
my code works fine and im getting the correct output, except when i submit the code, im getting output limit exceeded...i dont understand why?!
using namespace std;
int main()
{
char ch;
cin.get(ch);
while (ch != '\0')
{
if (ch == 10)
cout << ch;
else
cout << (static_cast<char>(ch-7));
cin.get(ch);
}
cout << '\n';
return 0;
}
my code works fine and im getting the correct output, except when i submit the code, im getting output limit exceeded...i dont understand why?!
-
- Learning poster
- Posts: 62
- Joined: Sun Jul 09, 2006 8:31 am
- Location: University of Dhaka
- Contact:
#458-got TLE,why?plz help
Regards.I got TLE for #458 but couldn't find the bug(s).Can anyboby help?
here is my code:
#include <iostream>
using namespace std;
int main()
{
char ch;
while((ch=cin.get())!=EOF)
{
if(ch==10)
cout<<"."<<endl;
else
{
ch-=7;
cout<<ch;
}
}
return 0;
}
here is my code:
#include <iostream>
using namespace std;
int main()
{
char ch;
while((ch=cin.get())!=EOF)
{
if(ch==10)
cout<<"."<<endl;
else
{
ch-=7;
cout<<ch;
}
}
return 0;
}