結果
| 問題 | 
                            No.994 ばらばらコイン
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-02-21 22:17:17 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 802 ms / 2,000 ms | 
| コード長 | 574 bytes | 
| コンパイル時間 | 2,530 ms | 
| コンパイル使用メモリ | 75,568 KB | 
| 実行使用メモリ | 53,964 KB | 
| 最終ジャッジ日時 | 2024-10-08 21:53:25 | 
| 合計ジャッジ時間 | 12,838 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 23 | 
ソースコード
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.math.*;
class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}
	
	void run() {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int K=sc.nextInt();
		int[] a=new int[N-1];
		int[] b=new int[N-1];
		for(int i=0;i<N-1;++i){
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
		}
		System.out.println(N>=K?K-1:-1);
	}
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}