Can someone please help me why my question is returning the wrong answer on submitting the answer. while testing with sample input it is working as expected.
Thanks in advance.
/* package codechef; // don’t place package name! */
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef {
public static void main(String[] args) throws java.lang.Exception {
Scanner scanner = new Scanner(System.in);
int inputLength = 0;
if (scanner.hasNext()) {
inputLength = scanner.nextInt();
}
while (inputLength-- > 0) {
int sa = 0;
int sb = 0;
int emptyCells = 0;
if (scanner.hasNext()) {
if (scanner.hasNext()) {
emptyCells = scanner.next().length() - 2;
}
if (scanner.hasNext()) {
sa = scanner.nextInt();
}
if (scanner.hasNext()) {
sb = scanner.nextInt();
}
int saInc = 1;
int sbInc = emptyCells;
boolean unsafe = false;
for (int i = 0; i < emptyCells; i++) {
saInc += sa;
sbInc -= sb;
if (saInc == sbInc) {
System.out.println("unsafe");
unsafe = true;
}
}
if (!unsafe) {
System.out.println("safe");
}
}
}
}
}
You know honestly I wonder how you have so much time to patiently help so many people, you’re amazing man. How do you manage to do it?
Cases where stuff fails ,
“format your code” should be your catchphrase
Logic explanation
Well documented codes.
Pseudo-admin xD
Great stuff
It shouldn’t be hard for you to get a job man.
You have insane coding skills + ( I stalked you on LinkedIn (ouch) , goddamn makes me feel like a kid,you have insane experience)
After all the work you’ve done, what motivates you to keep pushing forward ?
And the first thing you felt while seeking a job?