【算法笔记】B1053 住房空置率
作者:互联网
看了半天发现是题目理解错了,可能空置的里面观察期超过D则判定空置,而不是用电量低于e的天数超过D。
code
1 #include <bits/stdc++.h> 2 using namespace std; 3 4 int main(){ 5 int n, d, p_empty = 0, empty = 0; 6 double e, use; 7 cin>>n>>e>>d; 8 int days[n]; 9 for(int i = 0; i < n; i++){ 10 int day = 0; 11 cin>>days[i]; 12 for(int j = 0; j < days[i]; j++){ 13 cin>>use; 14 if(use < e) day++; 15 } 16 if(day>(days[i]/2)){ 17 if(days[i]>d) empty++; 18 else p_empty++; 19 } 20 } 21 printf("%.1lf%% %.1lf%%\n",(double)p_empty/n*100, (double)empty/n*100); 22 return 0; 23 }
标签:use,空置率,B1053,++,days,int,算法,day,empty 来源: https://www.cnblogs.com/chunlinn/p/10794217.html