You are viewing a single comment's thread. Return to all comments →
dude it is because if modulo comes zero than it simply prints zero try this:
*
for(int i=0; i<t; i++){ int p = s.nextInt(); int m = s.nextInt(); int id = s.nextInt(); if((m+id-1)%p==0) System.out.println(p); else System.out.println((m+id-1)%p); }
Seems like cookies are disabled on this browser, please enable them to open this website
Save the Prisoner!
You are viewing a single comment's thread. Return to all comments →
dude it is because if modulo comes zero than it simply prints zero try this:
*
*