hihoCoder太阁最新面经算法竞赛4 register

Ended

Participants:109

Verdict:Accepted
Score:100 / 100
Submitted:2016-06-12 16:18:31

Lang:Java

Edit
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
import java.util.Scanner;
import java.util.Arrays;
public class Main{
   
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        String t=sc.nextLine();
       
        int T=Integer.parseInt(t);
       
        Main ma=new Main();
        for(int i=0;i<T;i++)
        {
            String[] temp=sc.nextLine().split(" ");
            int N=Integer.parseInt(temp[0]);
            int M=Integer.parseInt(temp[1]);
            
            Graph g=ma.new Graph(N,M);
            boolean add=true;
            for(int j=0;j<M;j++)
            {
            temp=sc.nextLine().split(" ");
            int S=Integer.parseInt(temp[0]);
            int E=Integer.parseInt(temp[1]);
            add=g.AddEdge(S-1E-11);
            if(add==false)
                break;
            }
            if(M!=N-1)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX