You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;
public class Solution {
public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int m[]=new int[n]; int d[]=new int[n]; int count=0; for(int i=0;i<n;i++){ m[i]=sc.nextInt(); d[i]=sc.nextInt(); } for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(i!=j) { if((d[i]%m[j]==d[j]%m[i])) if((m[i]!=m[j])) count++; }} } System.out.println(count/2); }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Jim and the Jokes
You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;
public class Solution {
}