11946 - Code Number

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

Moderator: Board moderators

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11946 - Code Number

Post by brianfry713 »

You're reading and writing to files.
Check input and AC output for thousands of problems on uDebug!
alfar01
New poster
Posts: 2
Joined: Tue Feb 14, 2012 3:27 pm
Location: Tainan,Taiwan

Re: 11946 - Code Number

Post by alfar01 »

still get WA after removing the code of file reading
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11946 - Code Number

Post by brianfry713 »

For the sample input, you're not printing a newline at the end of the output.
Check input and AC output for thousands of problems on uDebug!
mahade hasan
Learning poster
Posts: 87
Joined: Thu Dec 15, 2011 3:08 pm
Location: University of Rajshahi,Bangladesh

Re: 11946 - Code Number

Post by mahade hasan »

In this sample input
H3LL0 MY L0V3, 1 M H499Y 83C4U53 500N 1 W1LL 83 70 Y0UR 51D3.
7H15 71M3 W17H0U7 Y0U H45 833N 373RN4L. 1 1NV173 Y0U 70 7H3 200
0N3 70 533 7H3 238R42 4ND 60R1L42.

here 2==Z and 2==S somewhere in output
HELLO MY LOVE, I M HAPPY BECAUSE SOON I WILL BE TO YOUR SIDE.
THIS TIME WITHOUT YOU HAS BEEN ETERNAL. I INVITE YOU TO THE ZOO
ONE TO SEE THE ZEBRAS AND GORILAS.

it's confuse me..................
we r surrounded by happiness
need eyes to feel it!
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11946 - Code Number

Post by brianfry713 »

5 should be S, 2 is Z. The sample I/O at the bottom of the problem statement is correct, the one in the middle is wrong.
Last edited by brianfry713 on Wed Jun 13, 2012 11:01 pm, edited 1 time in total.
Check input and AC output for thousands of problems on uDebug!
mahade hasan
Learning poster
Posts: 87
Joined: Thu Dec 15, 2011 3:08 pm
Location: University of Rajshahi,Bangladesh

Re: 11946 - Code Number

Post by mahade hasan »

cut>>thanks for help!!
Last edited by mahade hasan on Thu Jun 14, 2012 8:24 am, edited 1 time in total.
we r surrounded by happiness
need eyes to feel it!
Evan72
New poster
Posts: 11
Joined: Sat Apr 28, 2012 2:01 pm

Re: 11946 - Code Number WHY WA?PLZ HELP!

Post by Evan72 »

Code: Select all

got AC
Last edited by Evan72 on Fri Jun 15, 2012 10:40 pm, edited 1 time in total.
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11946 - Code Number

Post by brianfry713 »

mahade hasan wrote:now i m dealing with WAWAWA!!
I had them switched, 5 should be S, 2 is Z.
Check input and AC output for thousands of problems on uDebug!
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11946 - Code Number WHY WA?PLZ HELP!

Post by brianfry713 »

Evan72, You need to copy the newlines.
Check input and AC output for thousands of problems on uDebug!
mahade hasan
Learning poster
Posts: 87
Joined: Thu Dec 15, 2011 3:08 pm
Location: University of Rajshahi,Bangladesh

Re: 11946 - Code Number

Post by mahade hasan »

brianfry713 wrote:
mahade hasan wrote:now i m dealing with WAWAWA!!
I had them switched, 5 should be S, 2 is Z.
thanks for help.........
we r surrounded by happiness
need eyes to feel it!
Evan72
New poster
Posts: 11
Joined: Sat Apr 28, 2012 2:01 pm

Re: 11946 - Code Number WHY WA?PLZ HELP!

Post by Evan72 »

brianfry713 wrote:Evan72, You need to copy the newlines.
Thanx..got AC :)
ashdboss
New poster
Posts: 16
Joined: Fri May 17, 2013 8:59 am

Re: 11946 - Code Number

Post by ashdboss »

Getting wrong answer for 11946. Need help
deleting code.got the problem. Accepted. :)
nildorpon
New poster
Posts: 4
Joined: Sun Jul 21, 2013 4:13 pm

Re: 11946 - Code Number

Post by nildorpon »

Why Runtime error?
Please take a look on my code

import java.io.BufferedInputStream;
import java.util.Scanner;

public class Main {
public static void main(String[] args){
Scanner scanner = new Scanner(new BufferedInputStream(System.in));
int t = 0;
String str = "";
StringBuilder sb = null;
while (scanner.hasNext()){
t =Integer.parseInt(scanner.nextLine());
if((t>= 1) && (t<=30)){
for(int i = 0; i<t;i++){
boolean isTrue = true;
while(isTrue){
str = scanner.nextLine();
if(str.equals("")){
isTrue = false;
}else {
sb = new StringBuilder();
for(int j = 0; j< str.length(); j++){
sb.append(getValue(str.charAt(j)));
}
System.out.println(sb);
}
}
System.out.println();
}
}
}
}

private static char getValue(char c){
char value;
switch (c){
case '3': value = 'E';
break;
case '0': value = 'O';
break;
case '4': value = 'A';
break;
case '9': value = 'P';
break;
case '8': value = 'B';
break;
case '5': value = 'S';
break;
case '7': value = 'T';
break;
case '2': value = 'Z';
break;
case '6': value = 'G';
break;
case '1': value = 'I';
break;
default:value = c;
break;
}
return value;
}
}
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11946 - Code Number

Post by brianfry713 »

Check input and AC output for thousands of problems on uDebug!
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

Re: 11946 - Code Number

Post by uDebug »

Replying to follow the thread.
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.
Post Reply

Return to “Volume 119 (11900-11999)”