-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHieuSoNguyenLon1.java
More file actions
35 lines (35 loc) · 1.02 KB
/
HieuSoNguyenLon1.java
File metadata and controls
35 lines (35 loc) · 1.02 KB
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
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package baitap;
import java.util.*;
import java.math.*;
/**
*
* @author khanh
*/
public class HieuSoNguyenLon1 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=Integer.parseInt(sc.nextLine());
while(t-->0){
BigInteger a=sc.nextBigInteger();
String aa=a.toString();
int la=aa.length();
BigInteger b=sc.nextBigInteger();
String bb=b.toString();
int lb=bb.length();
BigInteger c=a.subtract(b).abs();
String cc=c.toString();
int lc=cc.length();
int ll=Math.max(la, lb);
if(ll>lc){
for(int i=0;i<ll-lc;i++){
System.out.print("0");
}
}
System.out.println(c);
}
}
}