We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
importjava.io.*;importjava.util.*;importjava.text.*;importjava.math.*;importjava.util.regex.*;publicclassSolution{publicstaticvoidmain(String[]args){/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */Scannerin=newScanner(System.in);inti=in.nextInt();intj=in.nextInt();intk=in.nextInt();intcount=0;for(inta=i;j>a;a++){StringBuildertemp=newStringBuilder();temp.append(a);temp=temp.reverse();Stringtemp1=temp.toString();intaRev=Integer.parseInt(temp1);if(Math.abs((a-aRev)%k)==0){count++;}}System.out.println(count);}}
Beautiful Days at the Movies
You are viewing a single comment's thread. Return to all comments →
Solution in Java