Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
from itertools import chain, combinations_with_replacement as combi_r def solve(d): n=map(int, d.split(',')) s=set(n) a=[(x,y,z) for x in xrange(1, n[0]+1) for y in xrange(x, n[-1]+1) for z in xrange(max(y, n[-1]/3), n[-1]+1) if s == s&{sum(c) for c in chain(*[combi_r((x,y,z), r) for r in (1,2,3)])}] return not a and 'none' or a[1:] and 'many' or ','.join(map(str, a[0])) from itertools import * de
使い方 toolz により提供される関数は次の3つに大別されます。このうちItertoolz 、Functoolz は、それぞれitertools 、functools の拡張に相当する機能を提供します。 Itertoolz Functoolz Dicttoolz toolzはmap 、reduce 、filter など標準で使用できる関数も提供しています。これらをインポートするとmap であればitertools.imap のようにIterableを扱える関数に置き換えられます。これらの関数の使い方については元のものとほぼ同じなので割愛します。 以下、よく使いそうな関数を紹介していきます。 Itertoolz itertools 相当の機能を提供します。itertoolsのレシピに載っているような関数もあります。 要素の取得 - get, pluck get get はシークエンスや辞書
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く