-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathI053.java
More file actions
56 lines (54 loc) · 1.82 KB
/
I053.java
File metadata and controls
56 lines (54 loc) · 1.82 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package levelB;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
public class I053 {
public static void main(String[] args) throws Exception{
I053 pat=new I053();
DecimalFormat df=new DecimalFormat("0.0");
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
String observe[]=bf.readLine().split(" "); //总套数 低电量阈值 观察阈值
int N=Integer.parseInt(observe[0]);
double e=Double.parseDouble(observe[1]);
int D=Integer.parseInt(observe[2]);
String house[]=new String[N];
for(int i=0;i<house.length;i++){
house[i]=bf.readLine();
}
bf.close();
int pos=0; //可能空置的数量
int must=0; //一定空置的数量
for(int i=0;i<house.length;i++){
int fit=0;
double elec[]=pat.split(house[i]);
for(int j=1;j<elec.length;j++){
if(elec[j]<e){
fit++;
}
}
if(fit<=elec[0]/2){
continue;
}
else{
if(elec[0]>D){
must++;
}else{
pos++;
}
}
}
// double b=must*100.0/N;
// double a=pos*100.0/N;
double b=(double)Math.round(must*10.0*100/N)/10;
double a=(double)Math.round(pos*10.0*100/N)/10;
System.out.println(df.format(a)+"%"+" "+df.format(b)+"%");
}
public static double[] split(String string){
String str[]=string.split(" ");
double m[]=new double[str.length];
for(int i=0;i<m.length;i++){
m[i]=Double.parseDouble(str[i]);
}
return m;
}
}