0

Works absolutely fine on my laptop why is it not working on this app

The solution is of drivers licence from the app, hard level

30th Mar 2020, 2:45 PM
Shubham Prashant
Shubham Prashant - avatar
6 Respuestas
+ 5
Your problems seems to be the input. Inputformat: String Integer String Everything is in a new line. But nextInt() does not jump in the next line. (Yes, sololearn input is a bit strange ;)) String n = ob.nextLine(); int x = Integer.valueOf(ob.nextLine()); String a = ob.nextLine();
30th Mar 2020, 3:09 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
Please show your code.
30th Mar 2020, 2:51 PM
Hatsy Rei
Hatsy Rei - avatar
0
import java.util.*;//lisence program from app class revise { public static void main(String args[]) { Scanner ob=new Scanner(System.in); String n=ob.nextLine(); int x=ob.nextInt(); // System.out.println(""); String a=ob.nextLine(); a=a+" "; String s=""; int t=0,c=1,m; for(int j=0;j<a.length();j++) { if(a.charAt(j)!=' ') s=s+a.charAt(j); else { if(n.compareTo(s)>0) { c++; s=""; } else break; } } if(c%x==0) t=t+20*(c/x); else { m=(c-(c%x))+x; t=t+20*(m/x); }System.out.println(t);; } }
30th Mar 2020, 2:51 PM
Shubham Prashant
Shubham Prashant - avatar
0
Works perfectly fine on jcreator, even tried the test cases of the app
30th Mar 2020, 2:53 PM
Shubham Prashant
Shubham Prashant - avatar
0
Can't give any input, the app checks the test cases itself. The unlocked test cases are giving correct output on jcreator
30th Mar 2020, 3:00 PM
Shubham Prashant
Shubham Prashant - avatar