QQuotaMosaic
製品

ソフトウェアの機能 · 最大剰余による配分

01

QuotaMosaicは整数部分を先に配り、明確な同順位規則で剰余に従って残席を配る処理のレビューを支援します。

01

モデル

OpenAI互換またはAnthropicのエンドポイントを、ベースURLと必要なAPIキーで設定し、接続をテストします。ローカルのモデルサーバーは起動が必要です。リモートツールは別途データを送信する場合があります。

02

プロジェクト

フォルダーを選び、編集前に関連ファイルを読むようアシスタントに依頼します。作業の目的と変更範囲を明確にしてください。

03

変更内容

変更内容とコマンド出力を確認します。結果を採用する前にプロジェクトの検証を実行してください。生成コードが自動的にテスト済みになるわけではありません。

最大剰余による配分

● ● ●QuotaMosaic●
ワークフロー · 最大剰余による配分 ×
def allocate(weights, seats):
    if type(weights) not in (list, tuple) or len(weights) > 1000:
        raise ValueError("weights.container")
    weights = tuple(weights)
    if type(seats) is not int or not 0 <= seats <= 10000:
        raise ValueError("seats.range")
    if len(weights) > 1000 or any(type(w) is not int or w < 0 for w in weights):
        raise ValueError("weights.invalid")
    total = sum(weights)
    if total == 0:
        if seats:
            raise ValueError("weight.zero")
        return [0] * len(weights)
    result = [w * seats // total for w in weights]
    remaining = seats - sum(result)
    order = sorted(range(len(weights)), key=lambda i: (-(weights[i] * seats % total), i))
    for i in order[:remaining]:
        result[i] += 1
    return result
✳最大10000席を最大1000個の非負整数の重みに最大剰余で配分します。
✓ 変更内容適用前に確認 ↗
ワークスペースのイメージ
AIコーディングワークスペース

次のアイデアはここから。

Windows版をダウンロード ↗