一只书虫仔 @ 2019-02-20 20:55:10
#include<bits/stdc++.h>
using namespace std;
const int NR = 5500;
int main () {
int n;//how many apple
int s;//tao's power
int a;//how long is chair
int b;//how long is arm
int x[NR];//how long is each apple
int y[NR];//each apple's power
int ans = 0;//how many apple in standard
scanf("%d%d%d%d", &n, &s, &a, &b);
for (int i = 1; i <= n; i++)
scanf("%d%d", &x[i], &y[i]);
for (int i = 1; i <= n; i++)
if (s >= y[i] && x[i] <= a + b) {
ans++;
s -= y[i];
}
printf("%d", ans);
return 0;
}
dalao!秋祝!QAQ!
by 一只书虫仔 @ 2019-02-20 20:57:08
详情请见:dalao看一看
by Aehnuwx @ 2019-02-20 21:02:43
二十分是什么情况
而师份时身妈请框
by Aehnuwx @ 2019-02-20 21:03:02
秋祝
求助
by 花里心爱 @ 2019-02-20 21:06:16
您语文真好Orz
by hfee @ 2019-02-20 21:06:45
(这个英语和谐音很迷啊) 你连排序都没排序怎么AC “陶陶想知道在s<0之前最多能摘到多少个苹果” 所以肯定是要先对力量进行排序的 我的代码:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,a,s,xi[10000],yi[10000],b,ans=0;
scanf("%d%d%d%d",&n,&s,&a,&b);
for(int i=0;i<n;i++)
{
scanf("%d%d",&xi[i],&yi[i]);
}
for(int i=0;i<n-1;i++)
{
for(int j=0;j<n-1-i;j++)
{
if(yi[j]>yi[j+1])
{
swap(xi[j],xi[j+1]);
swap(yi[j],yi[j+1]);
}
}
}
for(int i=0;i<n;i++)
{
if(s<=0) break;
if(a+b>=xi[i]&&s>=yi[i])
{
ans++;
s-=yi[i];
}
}
printf("%d",ans);
return 0;
}
by Kuriyama_Mirai @ 2019-02-20 21:06:54
你语文真好Orz
by hfee @ 2019-02-20 21:08:10
还有一件事:如果这个没看出来的话,我想问你你做出来的那道紫题是哪题QAQ(又想水题了)
by hfee @ 2019-02-20 21:09:14
突然发现我头顶有一个大佬47名%%%
by NaCly_Fish @ 2019-02-20 21:21:00
@白狼与玫瑰 qwq 我的排名只有他一半
by 花里心爱 @ 2019-02-20 21:23:53
@NaCly_Fish 反正Orz就对了