11946 - Code Number
Moderator: Board moderators
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11946 - Code Number
You're reading and writing to files.
Check input and AC output for thousands of problems on uDebug!
Re: 11946 - Code Number
still get WA after removing the code of file reading
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11946 - Code Number
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!
-
- Learning poster
- Posts: 87
- Joined: Thu Dec 15, 2011 3:08 pm
- Location: University of Rajshahi,Bangladesh
Re: 11946 - Code Number
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..................
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!
need eyes to feel it!
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11946 - Code Number
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!
-
- Learning poster
- Posts: 87
- Joined: Thu Dec 15, 2011 3:08 pm
- Location: University of Rajshahi,Bangladesh
Re: 11946 - Code Number
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!
need eyes to feel it!
Re: 11946 - Code Number WHY WA?PLZ HELP!
Code: Select all
got AC
Last edited by Evan72 on Fri Jun 15, 2012 10:40 pm, edited 1 time in total.
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11946 - Code Number
I had them switched, 5 should be S, 2 is Z.mahade hasan wrote:now i m dealing with WAWAWA!!
Check input and AC output for thousands of problems on uDebug!
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11946 - Code Number WHY WA?PLZ HELP!
Evan72, You need to copy the newlines.
Check input and AC output for thousands of problems on uDebug!
-
- Learning poster
- Posts: 87
- Joined: Thu Dec 15, 2011 3:08 pm
- Location: University of Rajshahi,Bangladesh
Re: 11946 - Code Number
thanks for help.........brianfry713 wrote:I had them switched, 5 should be S, 2 is Z.mahade hasan wrote:now i m dealing with WAWAWA!!
we r surrounded by happiness
need eyes to feel it!
need eyes to feel it!
Re: 11946 - Code Number WHY WA?PLZ HELP!
Thanx..got ACbrianfry713 wrote:Evan72, You need to copy the newlines.
![:)](./images/smilies/icon_smile.gif)
Re: 11946 - Code Number
Getting wrong answer for 11946. Need help
deleting code.got the problem. Accepted.![:)](./images/smilies/icon_smile.gif)
deleting code.got the problem. Accepted.
![:)](./images/smilies/icon_smile.gif)
Re: 11946 - Code Number
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;
}
}
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;
}
}
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11946 - Code Number
Check input and AC output for thousands of problems on uDebug!