You are viewing a single comment's thread. Return to all comments →
Hey guys, can someone please help me out as to why this is not working? Would appreciate any help. Thanx.
public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for(int a0 = 0; a0 < t; a0++){ int n = in.nextInt();int m; String x=""; if(n%3==0){ for(int i=0;i<n;i++){ x=x+"5"; } System.out.println(Long.parseLong(x)); } else{ for(m=n;m%5!=0;){ m=m-3; if(m<0) break; } if(m<0){ System.out.println(-1); continue; } else{ for(int i=m;i<n;i++){ x=x+"5"; } for(int i=0;i<m;i++){ x=x+"3"; } System.out.println(Long.parseLong(x)); } } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and The Beast
You are viewing a single comment's thread. Return to all comments →
Hey guys, can someone please help me out as to why this is not working? Would appreciate any help. Thanx.