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. BasicDataSource配备

    BasicDataSource配置 commons DBCP 配置参数简要说明 前段时间因为项目原因,要在修改数据库连接池到DBCP上,折腾了半天,有一点收获,不敢藏私,特在这里与朋友们共享. 在配置 ...

  2. [Everyday Mathematics]20150104

    设 $a>0$, $$\bex x_1=1,\quad x_{n+1}=x_n+an\prod_{i=1}^n x_i^{-\frac{1}{n}}. \eex$$ 试证: $$\bex \vl ...

  3. WebView(网络视图)的两种使用方式

    WebView(网络视图)能加载显示网页,可以将其视为一个浏览器.它使用了WebKit渲染引擎加载显示网页,实现WebView有以下两种不同的方法:第一种方法的步骤:1.在要Activity中实例化W ...

  4. 【LR】关于宽带与比特之间的关系

    1.比特=bps 2M比特的意思是2宽带 1M宽带=12M比特=1*1024K比特=1*1024*1024比特=1057648比特 2M宽带=2*1024*1024比特=2097152比特 4M宽带= ...

  5. nodejs学习笔记之mongoDB

    这两天在学习nodejs,但是发现那本书nodejs入门指南上所用的好多方法都报错. 这里主要说下数据库部分 关于注册部分:书上创建数据库那里可能要小心点,用户名不存在的时候,下面调用save的对象要 ...

  6. 关于Noise and Error主题的一些小知识

    (一)Noise会不会对VC bound产生影响? 此笔记源于台湾大学林轩田老师<机器学习基石><机器学习技法> 答案是不会. 当信号中加入了Noise,其实对我们之前学过的内 ...

  7. CSS 高级:尺寸、分类、伪类、伪元素

    CSS 尺寸:允许你控制元素的高度和宽度.同样,还允许你增加行间距. CSS 分类:允许你控制如何显示元素,设置图像显示于另一元素中的何处,相对于其正常位置来定位元素,使用绝对值来定位元素,以及元素的 ...

  8. 《Genesis-3D开源游戏引擎完整实例教程-2D射击游戏篇01:播放序列动画》

    1.播放序列动画 系列动画播放概述 2D游戏中的动画系统,不同于3D游戏.3D游戏中,角色美术资源不仅包含角色模型的,还包括角色的贴图和动作等,模型本身自带角色的动作动画效果.2D游戏中,角色美术资源 ...

  9. <Araxis Merge>保存文件

    1.保存文件 在任何时候都可以使用File菜单中的Save和Save As来保存文件.使用Save将修改的部分保存回文件.使用Save As将会用新名称来保存文件.在你右击文件面板的时候也可以从快捷菜 ...

  10. TQJson序列和还原clientdataset.data

    TQJson是QDAC开源项目的JSON对象,其特点是跨平台,功能强大. 序列 procedure TForm2.Button2Click(Sender: TObject);var AJson: TQ ...