Kurniady Systems - Tools
Viewing Text Document
Title:
INC 2008 Qual E
Owner: Andrian Kurniady
Last updated on: Tuesday, 15 July 2008
Description:
My solution for INC 2008 qualification problem E.
Content:
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
int data[10][10];
int main(){
int ntc;
scanf("%d", &ntc);
while (ntc--){
int n;
scanf("%d", &n);
for (int j=0;j<3;j++)
for (int i = 0;i<5;i++)
scanf("%d", &data[i][j]);
int res = 0;
for (int i=0;i<5;i++){
int duit = n;
int jual = 0;
while (duit>=0){
res>?=jual;
for (int j=i+1;j<5;j++){
int tduit = duit+jual*20;
int tjual = jual;
while (tduit>=0){
res>?=tjual;
tduit-=data[j][0]*3;
tduit-=data[j][1]*1;
tduit-=data[j][2]*2;
tjual++;
}
}
duit-=data[i][0]*3;
duit-=data[i][1]*1;
duit-=data[i][2]*2;
jual++;
}
}
printf("%d\n", res);
}
return 0;
}
Please note that the document shown may be copyrighted.
Please contact the owner of this document for the details.
Valid XHTML and CSS. Powered by Ruby on Rails.