Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.List;
- public class Main {
- public static void main(String[] args) {
- /* Pair[] games = {new Pair(7,3),
- new Pair(0,2),
- new Pair(4,5),
- new Pair(6,1)};
- */
- /* Pair[] games = {new Pair(3,2),
- new Pair(0,1)};
- */
- Pair[] games = {new Pair(1,3),
- new Pair(0,2),
- new Pair(4,5)};
- int counter = 0;
- for(int i=0; i<games.length;i++){
- int diff = Math.abs(games[i].getX() - games[i].getY());
- if(diff>1){
- counter ++;
- }
- }
- if(counter == 0) System.out.println("Result is "+counter);
- else System.out.println("Result is "+(counter-1));
- }
- }
- class Pair{
- private int x;
- private int y;
- public Pair(int x, int y){
- this.x = x;
- this.y = y;
- }
- public int getX(){
- return x;
- }
- public int getY(){
- return y;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement