H - Football Bets
Time Limit: 20 Sec

Memory Limit: 256 MB

题目连接

http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87493#problem/H

Description

While traveling to England, it is impossible not to catch the English passion for football. Almost everyone here is involved in football life: some play, others are watching, and the most risky ones bet on the results.

Before the start of the next season of English Premier League, a certain bookmaker office has launched a new option. In order to participate, players must bet a fixed (same for all) amount of money on one of the N teams participating in the championship. All players who guessed a team that will be the champion get back their owh bets. Additionally, they share equally one half of all bets made on the other teams.

During this event, at least one player made a bet, each player made exactly one bet on some of the teams, no teams received more than Kbets, and at the end of the tournament, the bookmaker's office reported a profit of exactly P percent of the total amount of bets.

Find any distribution of bets between teams which satisfies the above requirements, or determine that no such distribution exists.

Input

The input contains one line with three integers NK and P: the number of teams in the football tournament, the maximum possible number of bets on the one team and the profit reported by the bookmaker's office (2 ≤ N ≤ 100, 1 ≤ K ≤ 100, 0 ≤ P ≤ 100).

Output

If no distribution satisfying the requirements exists, print 0 on a separate line.

Otherwise, on the first line, print one integer W: the number of the winning team (1 ≤ W ≤ N). The second line must contain N integersA1A2, ..., AN where Ai is the number of bets on i-th team (0 ≤ Ai ≤ K). Note that the team order is arbitrary, but the number of winning team must fit this order. If there are several solutions, print any one of them.

Sample Input

4 100 10

Sample Output

2

10 80 5 5

HINT

题意

有n个队伍,每场比赛最多压k元钱,其中赌场要赚p%元

让你构造出来一个合法组合

题解

暴力枚举就好了,假设x为总的金额,y为压冠军队的钱

因为数据范围很小,所以直接暴力枚举

注意几个坑就吼了

代码:

#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <string>
#include <ctime>
#include <list>
#include <bitset>
typedef unsigned char byte;
#define pb push_back
#define input_fast std::ios::sync_with_stdio(false);std::cin.tie(0)
#define local freopen("in.txt","r",stdin)
#define pi acos(-1) using namespace std;
int n , k , p;
int sb;
int y;
int tx; int main(int argc,char *argv[])
{
cin >> n >> k >> p;
int ed = n * k ;
int ok = ;
if (p == )
{
cout << << endl;
cout << ;
for(int i = ; i <= n ; ++ i) cout << " " <<k;
cout << endl;
return ;
}
for(int x = ; x <= ed ; ++ x)
{
if (x*p % == )
{
y = x - (x*p)/;
if (y > && y <= k && (x-y) <= (n-)*k)
{
ok = ;
tx = x;
break;
}
}
}
sb = tx-y;
if (!ok) printf("0\n");
else
{
cout << << endl;
cout << y ;
for(int i = ; i <= n ; ++ i)
{
cout << " ";
if (sb >= k)
{
cout << k;
sb -=k;
}
else
{
cout << sb;
sb = ;
}
}
cout << endl;
}
return ;
}

Codeforces Gym 100425H H - Football Bets 构造的更多相关文章

  1. Codeforces Gym 100187K K. Perpetuum Mobile 构造

    K. Perpetuum Mobile Time Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/pro ...

  2. codeforces Gym 100187H H. Mysterious Photos 水题

    H. Mysterious Photos Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/p ...

  3. codeforces Gym 100500H H. ICPC Quest 水题

    Problem H. ICPC QuestTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/a ...

  4. Codeforces Gym 100114 H. Milestones 离线树状数组

    H. Milestones Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100114 Descripti ...

  5. codeforces gym 100357 H (DP 高精度)

    题目大意 有r*s张扑克牌,数字从1到 r,每种数字有s种颜色. 询问对于所有随机的d张牌,能选出c张组成顺子的概率和组成同花的概率. 解题分析 对于组成顺子的概率,令dp[i][j][k]表示一共选 ...

  6. codeforces gym 100286 H - Hell on the Markets (贪心算法)

    题目链接 题意:n个数分别为a[i],问是否存在一组对应的b[i],b[i]=1 || b[i]=-1,使得ai*bi的n项和为0. 题解: 先证明一个结论吧,对于1≤ai≤i+1,前面ai个数一定可 ...

  7. Codeforces gym 101343 J.Husam and the Broken Present 2【状压dp】

     2017 JUST Programming Contest 2.0 题目链接:Codeforces gym 101343 J.Husam and the Broken Present 2 J. Hu ...

  8. Codeforces GYM 100876 J - Buying roads 题解

    Codeforces GYM 100876 J - Buying roads 题解 才不是因为有了图床来测试一下呢,哼( 题意 给你\(N\)个点,\(M\)条带权边的无向图,选出\(K\)条边,使得 ...

  9. Codeforces Gym 101252D&&floyd判圈算法学习笔记

    一句话题意:x0=1,xi+1=(Axi+xi%B)%C,如果x序列中存在最早的两个相同的元素,输出第二次出现的位置,若在2e7内无解则输出-1. 题解:都不到100天就AFO了才来学这floyd判圈 ...

随机推荐

  1. 滑屏 H5 开发实践九问

    滑屏的交互形式自从在 H5 中流行起来,便广泛应用在产品宣传.广告.招聘和活动运营等场景中,作为微信朋友圈广告惯用的形式,其影响力更是得到了强化与放大.如今滑屏H5可谓玲琅满目,数不尽数. 作为一个 ...

  2. hadoop2.20.0集群安装教程

    一.安装的需要软件及集群描述 1.软件: Vmware9.0:虚拟机 Hadoop2.2.0:Apache官网原版稳定版本 JDK1.7.0_07:Oracle官网版本 Ubuntu12.04LTS: ...

  3. TextView字体和背景图片 设置透明度

    背景图片透明度设置  viewHolder.relative_layout.getBackground().setAlpha(225);     0  ---  225 ((TextView)tv). ...

  4. Json::Value使用心得

    Json::Value 是sourceforge开源项目jsoncpp的数据对象,用来处理json数据  下载 1.打印Json数据 Json::Value jv; Json::FastWriter ...

  5. hdu 2087-剪花布条(KMP)

    题意: 求文本串最多可以分成几个模式串. 分析: KMP #include <map> #include <set> #include <list> #includ ...

  6. IOS AsyncSocket

    导入AsyncSocket.h  AsyncSocket.m   AsyncUdpSocket.h   AsyncUdpSocket.m   以及  CFNetWork.framework async ...

  7. JavaScript遍历方式详解

    为了方便例子讲解,现有数组和json对象如下: var demoArr = ['Javascript', 'Gulp', 'CSS3', 'Grunt', 'jQuery', 'angular']; ...

  8. Request、Request.Form和Request.QueryString的区别

    Request.Form:获取以POST方式提交的数据(接收Form提交来的数据): Request.QueryString:获取地址栏参数(以GET方式提交的数据) Request:包含以上两种方式 ...

  9. flashback table恢复数据

    flashback table恢复数据 flashback table主要是是用undo 表空间的内容,进行对数据修改的回退操作 语法如下: 根据scn号来进行回退 SQL> flashback ...

  10. sensor BMA250源代码执行分析

    重力传感器是根据压电效应的原理来工作的.   所谓的压电效应就是 “对于不存在对称中心的异极晶体加在晶体上的外力除了使晶体发生形变以外,还将改变晶体的极化状态,在晶体内部建立电场,这种由于机械力作用使 ...