Skip to content

Commit 5303a45

Browse files
Wrong Answer
HashSet
1 parent 7b088e3 commit 5303a45

File tree

4 files changed

+72
-25
lines changed

4 files changed

+72
-25
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.mycompany.j04006;
2+
3+
/*
4+
* To change this license header, choose License Headers in Project Properties.
5+
* To change this template file, choose Tools | Templates
6+
* and open the template in the editor.
7+
*/
8+
/**
9+
*
10+
* @author Admin //
11+
*/
12+
//import com.mycompany.j04006.J04006;
13+
import java.util.*;
14+
15+
public class Khai_Bao {
16+
17+
public static void main(String[] args) {
18+
Scanner sc = new Scanner(System.in);
19+
int t = sc.nextInt();
20+
while (t-- >0) {
21+
String name = sc.nextLine();
22+
String cls = sc.nextLine();
23+
String date = sc.nextLine();
24+
Float degree = sc.nextFloat();
25+
26+
Sinh_Vien sv = new Sinh_Vien(name, cls, date, degree);
27+
sv.result();
28+
}
29+
}
30+
}

J04006/src/main/java/com/mycompany/j04006/Nhap.java

-21
This file was deleted.

J04006/src/main/java/com/mycompany/j04006/J04006.java J04006/src/main/java/com/mycompany/j04006/Sinh_Vien.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
*/
1313
import java.text.SimpleDateFormat;
1414
import java.util.Date;
15-
public class J04006 {
16-
String name,cls,date;
17-
Float degree;
18-
public J04006(String name, String cls,String date, Float degree){
15+
public class Sinh_Vien {
16+
private String name,cls,date;
17+
private Float degree;
18+
public Sinh_Vien(String name, String cls,String date, Float degree){
1919
this.name = name;
2020
this.cls = cls;
2121
this.date = date;
@@ -32,6 +32,7 @@ public void result(){
3232
String degre = String.format("%.2f", this.degree);
3333
// Date date = formatter.format(this.date);
3434
System.out.print("B20DCCN001 " + this.name + " " +this.cls + " " + date+" " + degre);
35+
System.out.println("\n");
3536
}
3637

3738
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* To change this license header, choose License Headers in Project Properties.
3+
* To change this template file, choose Tools | Templates
4+
* and open the template in the editor.
5+
*/
6+
package com.mycompany.set_map;
7+
8+
/**
9+
*
10+
* @author Admin
11+
*/
12+
import java.util.HashSet;
13+
import java.util.Scanner;
14+
import java.util.Arrays;
15+
public class J08012 {
16+
public static void main(String[] args) {
17+
Scanner sc = new Scanner(System.in);
18+
HashSet<Integer> hs_v = new HashSet<>();
19+
HashSet<Integer> hs_e = new HashSet<>();
20+
int n = sc.nextInt();
21+
int tmp = n;
22+
while (n-->1){
23+
int[] arr = new int[2];
24+
arr[0] = sc.nextInt();
25+
arr[1] = sc.nextInt();
26+
Arrays.sort(arr);
27+
hs_v.add(arr[0]);
28+
hs_e.add(arr[1]);
29+
}
30+
if(hs_v.size() == 1 && hs_e.size() == tmp-1){
31+
System.out.println("Yes");
32+
}
33+
else{
34+
System.out.println("No");
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)