Pagini recente » Cod sursa (job #1772023) | Cod sursa (job #1566232) | Cod sursa (job #2667079) | Cod sursa (job #641343) | Cod sursa (job #442952)
Cod sursa(job #442952)
#include<fstream>
#include<cstdlib>
#include<vector>
#include<algorithm>
using namespace std;
struct Gutui{
unsigned long h;
unsigned long w;
bool operator() (Gutui a, Gutui b) { return (a.h < b.h); }
}gutui;
int main(){
unsigned long n,h,u,u1=0,hmax=0,umax=0;
ifstream fin ("gutui.in");
ofstream fout ("gutui.out");
fin>>n>>h>>u;
vector<Gutui> g(n);
for (int i=0; i<n; i++)
fin>>g[i].h>>g[i].w;
sort(g.begin(),g.end(),gutui);
for (int i=n-1; i>=0; i--)
{
while (g[i].h+u1 < h)
{
hmax=g[i].h;
u1+=10;
umax+=g[i].w;
}
}
fout<<umax<<endl;
fin.close();
fout.close();
return 0;
}