Przekraczam ilość czasu na SPOJU. http://pl.spoj.com/problems/PP0501A/ Co tu można poprawić?
public static void main(String[] args) {
Scanner skaner = new Scanner(System.in);
int liczbaTestow = skaner.nextInt();
for(int i=0;i<liczbaTestow;i++) {
int a,b;
a = skaner.nextInt();
b = skaner.nextInt();
int m = 0;
if(a>b){
m = b;
if(m<0){
m=-m;
}
}
else if(b>a){
m = a;
if(m<0){
m=-m;
}
}
for(int j=m;j>0;j--){
int c = a%j;
int d = b%j;
if(c==0 && d==0){
System.out.println(j);
break;
}
}
}
}