Created
September 8, 2013 22:59
-
-
Save rfaisal/6489312 to your computer and use it in GitHub Desktop.
Cyael is a teacher at a very famous school in Byteland and she is known by her students for being very polite to them and also to encourage them to get good marks on their tests. Then, if they get good marks she will reward them with candies :) However, she knows they are all very good at Mathematics, so she decided to split the candies evenly t…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Scanner; | |
| public class SplittingCandies { | |
| public static long getStudentCandies(long N, long K){ | |
| if(K==0) return 0; | |
| return N/K; | |
| } | |
| public static long getTeacherCandies(long N, long K){ | |
| if(K==0) return N; | |
| return N%K; | |
| } | |
| public static void main(String[] args) { | |
| Scanner scanner = new Scanner( System.in ); | |
| int t=scanner.nextInt(); | |
| for(int i=0;i<t;i++){ | |
| long n=scanner.nextLong(); | |
| long k=scanner.nextLong(); | |
| System.out.println(getStudentCandies(n,k)+" "+getTeacherCandies(n,k)); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment