• URAL 1430 Crime and Punishment


    Crime and Punishment

    Time Limit:500MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u

    Description

    Background

    Petty bureaucrat Victor Thiefton was disposed towards stealing from his childhood. But one thing is to legally privatize national factories, diamond fields and oil derricks at the cost of billions dollars. And another thing is to filch some money from a poor regional budget. Our legislation is very strict. Therefore Victor felt that justice is on the alert just after he extracted his hand from the national pocket. What should he do to escape inevitable punishment?

    Mr. Thiefton has once heard that in accordance with the criminal legislation standards he would be condemned to long imprisonment for a theft whereas in case of a peculation he could escape with a suspended sentence only. So if the most part of stolen money is peculated, the duration of imprisonment will be reduced.

    Problem

    The same evening Mr. Thiefton burst into "MegaApril" superstore and rushed for overflowing storefronts carrying a purse with N stolen dollars. It appeared that unlimited number of high-quality goods and goods at moderate price were on sale in the superstore. High-quality goods cost A dollars per piece, and goods at moderate price cost B dollars per piece. Victor should spend as much stolen money as possible to reduce the duration of imprisonment to a minimum.

    Input

    The only line contains the integer numbers A, B and N (1 ≤ A, B, N ≤ 2∙109).

    Output

    You should output the number of high-quality goods and the number of goods at moderate price, which should be bought to guarantee the minimal duration of imprisonment for Victor. The numbers should be separated by single space. If the problem has several solutions, you should output any of them.

    Sample Input

    input
    output

    8 5 22
    
    2 1
     
    一下东西都是摘抄的,囧
     
    题目大意:给出a,b,N,要你找出自然数x,y满足:N-(a*x+b*y)最小,如果有多组解是,输出任意一组。
    ::做法貌似是暴力加贪心。
    view code
  • 相关阅读:
    [CF538F]A Heap of Heaps(主席树)
    [BZOJ1901][luogu2617]Dynamic Rankings(树状数组+主席树)
    [BZOJ3932][CQOI2015]任务查询系统(差分+主席树)
    [BZOJ2588]Count on a tree(LCA+主席树)
    [BZOJ2733][HNOI2012] 永无乡(线段树合并)
    [BZOJ1604][Usaco2008 Open]Cow Neighborhoods 奶牛的邻居 (Treap+单调队列)
    【贪心】POJ2376-Cleaning Shifts
    【穷竭】POJ3187-Backward Digit Sums
    【枚举+贪心】POJ2718-Smallest Difference
    【BFS】POJ3669-Meteor Shower
  • 原文地址:https://www.cnblogs.com/zyx1314/p/3890001.html
Copyright © 2020-2023  润新知