2024年3月2日(土)開催 DDCC2024予選は終了しました。
N君の遠足
N君は遠足に行くことになり荷物の買い出しに行くことになりました。
購入する商品は合計2000円以内にしてください。
同じ商品名の商品を2つ以上購入することはできません。
また、商品のカテゴリ毎に以下の制約があります。
・おやつ("oyatu")のカテゴリの商品は合計500円以内にしてください。
・おもちゃ("omotya")のカテゴリの商品は購入しないでください。
・飲み物("nomimono")のカテゴリの商品は質量の合計が700g以上になるようにしてください。
なお、弁当("bento")のカテゴリの商品には特有の制約はありません。
入力データとして購入する候補となっている商品の情報が与えられます。
購入する商品の質量の合計に関して、最大値を解答してください。
質量の単位の「g」は解答に含めないようにしてください。
入力データには{商品名,カテゴリ,金額(単位: 円),質量(単位: g)}の情報を持った項目が並んでいます。
各項目が購入する候補となっている商品です。
入力データ中の金額と質量の数値はいずれも1以上2000以下の整数です。
商品名の文字数は32以下です。1つの入力データ内に同じ商品名の項目はありません。
カテゴリは "oyatu", "omotya", "nomimono", "bento" の4種類です。
各入力データの項目数は48個以下です。
各入力データに関して、「条件を満たす組み合わせが少なくとも1つ存在すること」が保証されます。
3パターンの入力データがあります。それぞれに対する答えを求め、カンマ区切りで答えてください。
- 例題
- {
{"suika","oyatu",2000,2000},
{"umebosi","bento",1500,500},
{"apple juice","nomimono",400,400},
{"tansansui","nomimono",500,300},
{"ginger ale","nomimono",300,200},
{"grape juice","nomimono",200,100},
{"kendama","omotya",1,500}
},
{
{"noriben","bento",500,500},
{"sandwich","bento",500,500},
{"tamagoyaki","bento",300,100},
{"banana","oyatu",200,400},
{"cake","oyatu",300,300},
{"dango","oyatu",200,200},
{"mizu","nomimono",200,1000},
{"grape juice","nomimono",500,100}
},
{
{"onigiri","bento",100,111},
{"crisps","oyatu",209,152},
{"chocolate","oyatu",153,243},
{"banana","oyatu",31,115},
{"sports drink","nomimono",850,401},
{"orange juice","nomimono",705,498},
{"syakeben","bento",422,2000},
{"ball","omotya",10,1111},
{"cookie","oyatu",203,158},
{"otya","nomimono",562,202},
{"senbei","oyatu",39,152}
}
- 例題の解答
- 1000,2800,3210
- 例題の解説
- 質量の単位の「g」は解答に含めないようにしてください。
【例題1問目】
「"apple juice", "tansansui", "ginger ale", "grape juice"」を購入したとき、1400円、1000gです。
飲み物しか買っていませんが、条件を満たしています。
どれだけ安いおもちゃでも購入してはいけません。
【例題2問目】
「"noriben", "sandwich", "tamagoyaki", "banana", "cake", "mizu"」を購入したとき、2000円、2800gです。
【例題3問目】
「"chocolate", "banana", "orange juice", "syakeben", "otya", "senbei"」を購入したとき、1912円、3210gです。
※以下の入力データをコピーして解答してください。
{"cake","oyatu",322,765},
{"chienowa","omotya",252,670},
{"jigsaw puzzle","omotya",410,974},
{"onigiri","bento",250,870},
{"salad","bento",314,481},
{"suika","oyatu",321,764},
{"chocolate","oyatu",59,86},
{"ham","bento",54,10},
{"ginger ale","nomimono",185,196},
{"mizu","nomimono",229,196},
{"umebosi","bento",347,873},
{"orange juice","nomimono",477,271},
{"crisps","oyatu",38,452},
{"banana","oyatu",49,943},
{"syakeben","bento",472,886},
{"ball","omotya",321,927},
{"apple juice","nomimono",408,302},
{"sandwich","bento",9,48},
{"cookie","oyatu",33,783},
{"sports drink","nomimono",230,197},
{"tamagoyaki","bento",22,696},
{"chikuwa","bento",286,90},
{"otya","nomimono",117,503},
{"sausage","bento",306,597},
{"senbei","oyatu",346,648}
},
{
{"syakeben","bento",110,200},
{"chikuwa","bento",200,200},
{"orange juice","nomimono",663,1987},
{"onigiri","bento",110,200},
{"apple juice","nomimono",505,2000},
{"kendama","omotya",1,2000},
{"grape juice","nomimono",312,1999},
{"sandwich","bento",110,200},
{"coffee","nomimono",2000,2000},
{"ukiwa","omotya",2000,1},
{"senbei","oyatu",5,40},
{"cake","oyatu",100,100},
{"noriben","bento",300,600},
{"crisps","oyatu",2000,2000},
{"chienowa","omotya",1,1}
},
{
{"apple tea","nomimono",324,118},
{"apple","oyatu",33,35},
{"gum","oyatu",97,828},
{"dango","oyatu",55,698},
{"coffee","nomimono",210,115},
{"grape","oyatu",140,401},
{"crisps","oyatu",32,794},
{"cookie","oyatu",24,522},
{"salad","bento",15,143},
{"sports drink","nomimono",125,75},
{"pine juice","nomimono",308,103},
{"umebosi","bento",19,206},
{"cake","oyatu",42,971},
{"cherry juice","nomimono",398,145},
{"senbei","oyatu",79,996},
{"onigiri","bento",105,84},
{"cocoa","nomimono",204,60},
{"gummy","oyatu",111,320},
{"banana","oyatu",41,837},
{"tamagoyaki","bento",45,45},
{"melon juice","nomimono",505,105},
{"sandwich","bento",73,80},
{"grape juice","nomimono",126,47},
{"tomato","bento",65,40},
{"suika","oyatu",29,955},
{"sausage","bento",61,203},
{"banana juice","nomimono",363,125},
{"tansansui","nomimono",181,60},
{"cherry","oyatu",241,105},
{"ham","bento",39,555},
{"syakeben","bento",10,301},
{"orange juice","nomimono",129,114},
{"peach juice","nomimono",364,129},
{"rice","bento",376,245},
{"yakisoba","bento",42,57},
{"otya","nomimono",104,68},
{"noriben","bento",86,228},
{"bread","bento",190,62},
{"milk","nomimono",180,102},
{"water","nomimono",109,30},
{"pudding","oyatu",68,807},
{"potate","bento",96,65},
{"chocolate","oyatu",40,550},
{"ball","omotya",1,2000},
{"apple juice","nomimono",74,116},
{"fish","bento",302,145},
{"chikuwa","bento",27,307},
{"ginger ale","nomimono",101,42}
}
配点:400点