forked from Tarang1993/codechef
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSPCANDY.java
44 lines (31 loc) · 825 Bytes
/
SPCANDY.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import java.util.Scanner;
class Solution {
public static void main(String[] args)
{
int i,j,n;
Scanner s=new Scanner(System.in);
n=s.nextInt();
long[][] a=new long[n][2];
for(i=0;i<n;i++)
{
for(j=0;j<2;j++)
{
a[i][j]=s.nextLong();
}
if(a[i][1]!=0)
{
System.out.print((a[i][0]/a[i][1]));
System.out.print(" ");
System.out.print((a[i][0]%a[i][1]));
System.out.println();
}
else
{
System.out.print("0");
System.out.print(" ");
System.out.print(a[i][0]);
System.out.println();
}
}
}
}