比赛 |
noip |
评测结果 |
WAAWWWTTTTTTTTTTTTTT |
题目名称 |
__卡片游戏 |
最终得分 |
10 |
用户昵称 |
Phosphorus15 |
运行时间 |
29.120 s |
代码语言 |
C++ |
内存使用 |
2.11 MiB |
提交时间 |
2016-11-04 19:38:20 |
显示代码纯文本
#include <iostream>
#include <cstdio>
#include <cstdlib>
using std::cin;
using std::cout;
using std::endl;
int n,l,r,s[500001];
int now = 0;
int cases;
int total;
double avg;
int main(int argc,char ** argv){
int tmp;
freopen("xgame.in","r",stdin);
freopen("xgame.out","w+",stdout);
cin>>n>>l>>r;
for(int x=1;x<=n;x++){
cin>>tmp;
s[x] = s[x-1] + tmp;
}
for(int x=1;x<=n;x++){
for(int y=x;y<=n;y++){
avg = (s[y] - s[x-1])/(y-x+1);
//cout<<x<<" "<<y<<endl;
//cout<<"avarage "<<avg<<endl;
cases++;
if(avg>=l&&avg<=r) total ++;
}
}
if(total==cases){
cout<<1<<endl;
return 0;
}else if(!total){
cout<<0<<endl;
return 0;
}
for(int x=2;x<=total;x++){
if(total%x==0&&cases%x==0){
total /=x;
cases /=x;
}
}
cout<<total<<'/'<<cases<<endl;
return 0;
}