Pagini recente » Cod sursa (job #2091571) | Cod sursa (job #724534) | Cod sursa (job #525462) | Cod sursa (job #550660) | Cod sursa (job #944712)
Cod sursa(job #944712)
/// Craciun Catalin
/// Greedy
/// www.infoarena.ro/problema/shop
#include <fstream>
using namespace std;
ifstream f("shop.in");
ofstream g("shop.out");
short int n;
short int c;
long l;
long A[31],B[31];
void sortare(){
long aux;
for (short int i=1;i<=n;i++)
for (short int j=i+1;j<=n;j++)
if (A[i]>A[j]){
aux=A[i];
A[i]=A[j];
A[j]=aux;
aux=B[i];
B[i]=B[j];
B[j]=aux;
}
}
int main(){
f>>n>>c>>l;
for (i=1;i<=n;i++)
f>>A[i]>>B[i];
f.close();
sortare();
return 0;
}