10082 - WERTYU

All about problems in Volume 100. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

ayon
Experienced poster
Posts: 161
Joined: Tue Oct 25, 2005 8:38 pm
Location: buet, dhaka, bangladesh

Re: 10082--runtime error

Post by ayon » Sun Dec 04, 2005 12:02 pm

abhi wrote:

Code: Select all

 
while (str[i])	
{
str[i]=sym;
here i is not initialized. i guess, i must be initialized to zero(not me). and sym also not initialized.
ishtiak zaman
----------------
the world is nothing but a good program, and we are all some instances of the program

User avatar
tmdrbs6584
Learning poster
Posts: 98
Joined: Sat Jan 21, 2006 12:45 pm
Location: Busan,Corea(Republic of)

Hmm

Post by tmdrbs6584 » Sun Feb 12, 2006 11:23 am

Why don't you make bigger array size?

bongssi
New poster
Posts: 14
Joined: Mon Jul 31, 2006 10:35 am

10082 WA....

Post by bongssi » Fri Aug 04, 2006 3:50 am

I don't know why I got WA. Plz help me!!
Here is my code.

----------------------------------------------------

#include <stdio.h>
#include <string.h>

char keyboard[] = "`1234567890-=QWERTYUIOP[]ASDFGHJKL;'ZXCVBNM,./";
char input[100];

int main(void){

unsigned int i, j, key_len, input_len;
key_len = strlen(keyboard);

while(scanf("%[^\n]", input) == 1){

input_len = strlen(input);

for(i=0; i<input_len; i++){

if(input == ' '){
printf(" ");
continue;
}

for(j=0; j<key_len; j++){

if(input == keyboard[j]){
printf("%c", keyboard[j-1]);
break;
}
}
}

printf("\n");
fflush(stdin);
}

return 0;
}

Darko
Guru
Posts: 580
Joined: Fri Nov 11, 2005 9:34 am
Location: Calgary, Canada

Post by Darko » Fri Aug 04, 2006 6:58 pm

You are missing the forward slash there (maybe something else, I just noticed that one)

biso
New poster
Posts: 1
Joined: Sat Aug 05, 2006 10:23 pm

10082 WA??

Post by biso » Sat Aug 05, 2006 10:28 pm

Hi all,

I am new to the ACM problems and this is my first code.
i don't know why it is not AC

Code: Select all

#include <iostream>
#include <string>
using namespace std;

int main()
{
    
    char c;
    string s="`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;ZXCVBNM,./";
    cin.unsetf(ios::skipws);
    
    while(cin >> c)
    {
        if (c != ' ' && c != '\n')
        {   
            int k = s.find(c);
            if (k >= 0)
               cout << s[k-1];
        }
        else
            cout << c;
    }
    return 0;
}

Tanahy
New poster
Posts: 1
Joined: Sat Aug 05, 2006 10:49 pm

Very simple

Post by Tanahy » Sat Aug 05, 2006 10:54 pm

You are forget ' this pacutation you must insert it in the string

Gungchil
New poster
Posts: 2
Joined: Mon Aug 21, 2006 3:10 pm

10082 WA but Why?

Post by Gungchil » Mon Aug 21, 2006 4:01 pm

I have to poor knowledge to find out the mistake.....
plz help me

Code: Select all

#include<stdio.h>
#include<string.h>
int main()
{
	char ch;
	while(ch!=EOF)
	{
		ch=getchar();
	
		if(ch=='W')
			printf("Q");
		else if(ch=='E')
			printf("W");
		else if(ch=='R')
			printf("E");
		else if(ch=='T')
			printf("R");
		else if(ch=='Y')
			printf("T");
		else if(ch=='U')
			printf("Y");
		else if(ch=='I')
			printf("U");	
		else if(ch=='O')
			printf("I");
		else if(ch=='P')
			printf("O");
		else if(ch=='[')
			printf("P");
		else if(ch=='S')
			printf("A");
		else if(ch=='D')
			printf("S");
		else if(ch=='F')
			printf("D");
		else if(ch=='G')
			printf("F");
		else if(ch=='H')
			printf("G");
		else if(ch=='J')
			printf("H");	  
		else if(ch=='K')
			printf("J");	  
		else if(ch=='L')
			printf("K");	  
		else if(ch==';')
			printf("L");	  
		else if(ch=='X')
			printf("Z");	  
		else if(ch=='C')	
			printf("X");	  
		else if(ch=='V')
			printf("C");	  
		else if(ch=='B')
			printf("V");	  
		else if(ch=='N')
			printf("B");	  
		else if(ch=='M')
			printf("N");	  
		else if(ch==',')
			printf("M");
		else if(ch=='\\')
			printf("]");
		else if(ch==']')
			printf("[");
		else if(ch=='/')
			printf(".");
		else if(ch=='.')
			printf(",");
		else if(ch==39)
			printf(";");
		else if(ch=='1')
			printf("~");
		else if(ch=='2')
			printf("1");
		else if(ch=='3')
			printf("2");
		else if(ch=='4')
			printf("5");
		else if(ch=='6')
			printf("5");
		else if(ch=='7')
			printf("6");
		else if(ch=='8')
			printf("7");
		else if(ch=='9')
			printf("8");
		else if(ch=='0')
			printf("9");
		else if(ch=='=')
			printf("-");
		else if(ch=='-')
			printf("0");
		else if(ch==' ')
			printf(" ");
		if(ch=='\n')
			printf("\n");
		}
	return;
}	   
		     	     
		     	     
		     	     
		     	     
		     	     
		     	     
		     	     
		     

kolpobilashi
Learning poster
Posts: 54
Joined: Mon Jan 02, 2006 3:06 am
Location: Dhaka,Bangladesh
Contact:

Post by kolpobilashi » Tue Aug 22, 2006 6:33 pm

check your code for the following input:

1
4
5

and as you declared main() function as int type,you should return a value(0 in this case), otherwise u'll get CE.
best regards. :)
Sanjana

sobuz
New poster
Posts: 4
Joined: Mon Aug 21, 2006 2:41 pm

Post by sobuz » Thu Aug 24, 2006 6:12 am

Thank You sanjana.You are very smart.
I got AC at all.

willieluc
New poster
Posts: 1
Joined: Tue Jan 23, 2007 2:00 pm

10082

Post by willieluc » Tue Jan 23, 2007 2:02 pm

#include<iostream>
using namespace std;
int main()
{
char a[1000000];
while( cin.getline(a,1000000))
{
for (int i=0;a!='\0';i++){
switch(a){
case 'W':
a='Q';
break;
case 'S':
a='A';
break;
case 'X':
a='Z';
break;
case 'E':
a='W';
break;
case 'D':
a='S';
break;
case 'C':
a='X';
break;
case 'R':
a='E';
break;
case 'F':
a='D';
break;
case 'V':
a[i]='C';
break;
case 'T':
a[i]='R';
break;
case 'G':
a[i]='F';
break;
case 'B':
a[i]='V';
break;
case 'Y':
a[i]='T';
break;
case 'H':
a[i]='G';
break;
case 'N':
a[i]='B';
break;
case 'U':
a[i]='Y';
break;
case 'J':
a[i]='H';
break;
case 'M':
a[i]='N';
break;
case 'I':
a[i]='U';
break;
case 'K':
a[i]='J';
break;
case ',':
a[i]='M';
break;
case 'O':
a[i]='I';
break;
case 'L':
a[i]='K';
break;
case '.':
a[i]=',';
break;
case 'P':
a[i]='O';
break;
case ';':
a[i]='L';
break;
case '/':
a[i]='.';
break;
case '[':
a[i]='P';
break;
case '\\':
a[i]=']';
break;
case '1':
a[i]='`';
break;
case '2':
a[i]='1';
break;
case '3':
a[i]='2';
break;
case '4':
a[i]='3';
break;
case '5':
a[i]='4';
break;
case '6':
a[i]='5';
break;
case '7':
a[i]='6';
break;
case '8':
a[i]='7';
break;
case '9':
a[i]='8';
break;
case '0':
a[i]='9';
break;
case '-':
a[i]='0';
break;
case '=':
a[i]='-';
break;

}
}
cout << a <<endl;
}
return 0;
}

User avatar
newton
Experienced poster
Posts: 162
Joined: Thu Jul 13, 2006 7:07 am
Location: Campus Area. Dhaka.Bangladesh
Contact:

Post by newton » Wed Aug 15, 2007 4:20 pm

if it is ACC
please remove your code.

communicate0
New poster
Posts: 1
Joined: Sat Nov 17, 2007 6:20 am

10082 WA~why?

Post by communicate0 » Sat Nov 17, 2007 6:27 am

MY CODE:

#include<stdio.h>
char a[4][14]={"`1234567890-=","QWERTYUIOP[]\\","ASDFGHJKL;'","ZXCVBNM,./"};
int main(){
char i;
int row,col;
while(i!=EOF){
i=getchar();
for(row=0;row<4;row++){
for(col=0;col<14;col++){
if(i==a[row][col]){
i=a[row][col-1];
goto m;
}
}
}
m:
printf("%c",i);
}
return 0;
}

ccu496410011
New poster
Posts: 1
Joined: Sat Nov 17, 2007 5:47 pm

10082 WA!! HELP~

Post by ccu496410011 » Sat Nov 17, 2007 5:52 pm

#include <stdio.h>
#include <stdlib.h>

main(void)
{
char a[]=" 1234567890-=WERTYUIOP[]\\SDFGHJKL;'XCVBNM,./";
char b[]=" `1234567890-QWERTYUIOP[]ASDFGHJKL;ZXCVBNM,.";
int i=0,j=0;
char c,inp[1000],ans[1000];
while((c=getchar())!='\n')
{
inp[i++]=c;
}
inp='\0';
for(i=0;i<1000;i++)
{
for(j=0;j<1000;j++)
{
if(a[j]==inp)
{
ans=b[j];
break;
}
}
}
printf("%s\n",ans);
}

apurba
New poster
Posts: 42
Joined: Sun Oct 07, 2007 10:29 pm

where to fix??????????

Post by apurba » Sat Nov 17, 2007 6:44 pm

Code: Select all



#include<stdio.h>
#include<string.h>
#include<ctype.h>

int main()
{
	char s[1000];
	long len;
	long i;


	while(gets(s))
	{
		len=strlen(s);
		for(i=0;i<len;i++)
		{
			if(s[i]=='B')
				printf("V ");
			else if(s[i]=='C')
				printf("X");
			else if(s[i]=='D')
				printf("S");
			else if(s[i]=='E')
				printf("W");
			else if(s[i]=='F')
				printf("D");
			else if(s[i]=='G')
				printf("F");
			else if(s[i]=='H')
				printf("G");
			else if(s[i]=='I')
				printf("U");
			else if(s[i]=='J')
				printf("H");
			else if(s[i]=='K')
				printf("J");
			else if(s[i]=='L')
				printf("K");
			else if(s[i]=='M')
				printf("N");
			else if(s[i]=='N')
				printf("B");
			else if(s[i]=='O')
				printf("I");
			else if(s[i]=='P')
				printf("O");
			else if(s[i]=='R')
				printf("E");
			else if(s[i]=='S')
				printf("A");
			else if(s[i]=='T')
				printf("R");
			else if(s[i]=='U')
				printf("Y");
			else if(s[i]=='V')
				printf("C");
			else if(s[i]=='W')
				printf("Q");
			else if(s[i]=='X')
				printf("Z");
			else if(s[i]=='Y')
				printf("T");
			else if(s[i]=='1')
				printf("`");
			else if(s[i]=='2')
				printf("1");
			else if(s[i]=='3')
				printf("2");
			else if(s[i]=='4')
				printf("3");
			else if(s[i]=='5')
				printf("4");
			else if(s[i]=='6')
				printf("5");
			else if(s[i]=='7')
				printf("6");
			else if(s[i]=='8')
				printf("7");
			else if(s[i]=='9')
				printf("8");
			else if(s[i]=='0')
				printf("9");
			else if(s[i]=='-')
				printf("0");
			else if(s[i]=='=')
				printf("-");
			else if(s[i]=='[')
				printf("P");
			else if(s[i]==']')
				printf("[");
			else if(s[i]=='\')
				printf("]");
			else if(s[i]==';')
				printf("L");
			else if(s[i]==''')
				printf(";");
			else if(s[i]==',')
				printf("M");
			else if(s[i]=='.')
				printf(",");
			else if(s[i]=='/')
				printf(".");
			else
				printf("%c",s[i]);
		}
		printf("\n");
	}
	return 0;
}

what's wrong????????????

Code: Select all

keep dreaming...

apurba
New poster
Posts: 42
Joined: Sun Oct 07, 2007 10:29 pm

what's wrong?????????

Post by apurba » Sat Nov 17, 2007 6:47 pm

Code: Select all



#include<stdio.h>
#include<string.h>
#include<ctype.h>

int main()
{
	char s[1000];
	long len;
	long i;


	while(gets(s))
	{
		len=strlen(s);
		for(i=0;i<len;i++)
		{
			if(s[i]=='B')
				printf("V ");
			else if(s[i]=='C')
				printf("X");
			else if(s[i]=='D')
				printf("S");
			else if(s[i]=='E')
				printf("W");
			else if(s[i]=='F')
				printf("D");
			else if(s[i]=='G')
				printf("F");
			else if(s[i]=='H')
				printf("G");
			else if(s[i]=='I')
				printf("U");
			else if(s[i]=='J')
				printf("H");
			else if(s[i]=='K')
				printf("J");
			else if(s[i]=='L')
				printf("K");
			else if(s[i]=='M')
				printf("N");
			else if(s[i]=='N')
				printf("B");
			else if(s[i]=='O')
				printf("I");
			else if(s[i]=='P')
				printf("O");
			else if(s[i]=='R')
				printf("E");
			else if(s[i]=='S')
				printf("A");
			else if(s[i]=='T')
				printf("R");
			else if(s[i]=='U')
				printf("Y");
			else if(s[i]=='V')
				printf("C");
			else if(s[i]=='W')
				printf("Q");
			else if(s[i]=='X')
				printf("Z");
			else if(s[i]=='Y')
				printf("T");
			else if(s[i]=='1')
				printf("`");
			else if(s[i]=='2')
				printf("1");
			else if(s[i]=='3')
				printf("2");
			else if(s[i]=='4')
				printf("3");
			else if(s[i]=='5')
				printf("4");
			else if(s[i]=='6')
				printf("5");
			else if(s[i]=='7')
				printf("6");
			else if(s[i]=='8')
				printf("7");
			else if(s[i]=='9')
				printf("8");
			else if(s[i]=='0')
				printf("9");
			else if(s[i]=='-')
				printf("0");
			else if(s[i]=='=')
				printf("-");
			else if(s[i]=='[')
				printf("P");
			else if(s[i]==']')
				printf("[");
			else if(s[i]=='\')
				printf("]");
			else if(s[i]==';')
				printf("L");
			else if(s[i]==''')
				printf(";");
			else if(s[i]==',')
				printf("M");
			else if(s[i]=='.')
				printf(",");
			else if(s[i]=='/')
				printf(".");
			else
				printf("%c",s[i]);
		}
		printf("\n");
	}
	return 0;
}

Code: Select all

keep dreaming...

Post Reply

Return to “Volume 100 (10000-10099)”