Source code for submission s693

Fn.java

  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5.  
  6. package basic;
  7.  
  8. import java.util.Scanner;
  9.  
  10. /**
  11.  *
  12.  * @author cteam043
  13.  */
  14. public class Fn {
  15.  
  16. public static void main(String[] args) {
  17.  
  18. Scanner in = new Scanner(System.in);
  19. int points, lines, n1, n2;
  20. int [] nodes = new int [10005];
  21.  
  22. while(in.hasNextInt()){
  23. points = in.nextInt();
  24. lines = in.nextInt();
  25.  
  26. for(int p = 0; p < nodes.length; p++)
  27. nodes[p] = 0;
  28.  
  29. for(int i = 0; i < lines; i++){
  30. n1 = in.nextInt();
  31. n2 = in.nextInt();
  32. nodes[n1]++;
  33. nodes[n2]++;
  34. }
  35. for(int p = 0; p < nodes.length; p++){
  36. if(nodes[p] >= 4){
  37. System.out.println("YES");
  38. return;
  39. }
  40. }
  41. System.out.println("NO");
  42. }
  43. }
  44.  
  45. }
  46.