简单模拟,写挫了,然后查了一天。。。。我去。。。。傻逼了。。。。。
因为,他,那个,最少掉一滴血,然后,就是最多1000血,就是1000到头。简单模拟
主要是结构体排序,我最后右端点没+n。无数次想放弃,。。。但是。。。终于找到了。。。。贼刺激
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <cmath>
using namespace std;
double x , y;
int n;
struct Node{
double p , d;
int pos;
}node[1010];
bool vis[1010];
bool cmp(Node a , Node b)
{
return a.d > b.d;
}
int main()
{
while(~scanf("%d %lf %lf",&n , &x , &y)){
memset(vis , 0 , sizeof(vis));
int i;
for(i = 1 ; i <= n ; i++) scanf("%lf %lf",&node[i].p , &node[i].d), node[i].pos = i;
sort(node + 1 , node + 1 + n , cmp);
double t = x , de = 0;
for(i = 0 ; i <= 3000 ; i++){
for(int j = 1 ; j <= n ; j++){
if(vis[j]) continue;
if(t / x <= node[j].p / 100 ){
vis[j] = 1;
de += node[j].d;
break;
}
}
t -= de;
t += y;
if(t <= 0) break;
}
if(t > 0) printf("What a pity eex!\n");
else{
printf("Luckly dog eex!\n");
int sum = 0;
printf("%d ",i + 1);
for(i = 1 ; i <= n ; i++) if(vis[i] == 1) sum++;
printf("%d\n", sum);
memset(vis, 0 ,sizeof(vis));
t = x ;
de = 0;
for(int i = 0 ; i <= 3000 ; i++){
for(int j = 1 ; j <= n ; j++){
// printf("t %lf %lf\n",t / x , node[j].p);
if(vis[j]) continue;
if(t / x <= node[j].p / 100 && vis[j] == 0){
vis[j] = 1;
de += node[j].d;
printf("%d %d\n",i , node[j].pos);
break;
}
}
t -= de;
t += y;
if(t <= 0) break;
}
}
}
return 0;
}