Write a program that calculates the optimal number of coins from a set of given denominations to produce a given amount of currency. The correct answer should be the lowest number of total coins given.
The first line:
k d1 d2 ... dk
| from noise import perlin_noise as noise | |
| from objects import building | |
| from objects import tree | |
| from pyglet.gl import * | |
| import math | |
| import random | |
| import vector | |
| tile_size = 32 | |
| tile_height = 24 |
| def fn(n, c): | |
| num = 0 | |
| a = range(1, n/2+1) + (n%2)*[0] | |
| b = range(n, n/2, -1) | |
| for _ in range(n-1 + n%2): | |
| for aa, bb in zip(a, b): | |
| if aa and bb: | |
| yield (num/min(c, n/2)+1, aa, bb) | |
| num += 1 | |
| a, b = a[0:1]+b[0:1]+a[1:-1], b[1:]+a[-1:] |
| STORE target_x << 0 | |
| STORE target_y << 0 | |
| STORE move_dir << @NORTH | |
| goto << @main | |
| @main | |
| EQUAL << target_x 0 | |
| iffgoto << @main_move | |
| EQUAL << target_y 0 | |
| iffgoto << @main_move |
| STORE counter << 397 | |
| STORE direction << @NORTH | |
| @LOOPSTART | |
| CALL << @CHECKS | |
| iftgoto << @LOOPSTART | |
| FFI << @MOVE direction | |
| POP | |
| MINUS << counter 1 | |
| STORE counter |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <string.h> | |
| struct symbol_table { | |
| int num; | |
| char sym[3]; | |
| }; | |
| struct symbol_table symbols[] = { |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <string.h> | |
| struct symbol_table { | |
| int num; | |
| char sym[3]; | |
| }; | |
| struct symbol_table symbols[] = { |
| #sixthgear, one-up me willya | |
| map = lambda s,f: __builtins__.map(f,s) | |
| # kaptin, safe from desg | |
| def map(source, func): | |
| return __builtins__.map(func, source) | |
| # sixthgear | |
| def mop(source, func): | |
| return map(func, source) |
| ; roman.s | |
| ; x86/BSD | |
| section .text | |
| global start | |
| start: | |
| pop ecx ; argc | |
| cmp ecx, 2 ; make sure we have input | |
| jl argerror |
| 22:28 < greghaynes> Are the happy hacking keyboards worth it? | |
| 22:28 < milkshakes> or i will have to unfriend you | |
| 22:29 < desg> lmao | |
| 00:37 < seabot> meenuh: if a girl hugs me is it okay to ask her if she wants to have sex | |
| 00:37 < AeroNotix> seabot: Perfectly acceptable | |
| 00:37 < desg> lmao | |
| 17:57 < Distilled> LOL | |
| 17:58 < Distilled> Patch notes: Prevent motherboard from catching fire. |