大致题意:

网球比赛,n个參赛者,每场比赛每位选手b瓶水+裁判1瓶水,所有比赛每一个參赛者p条毛巾

每一轮比赛有2^k个人參加比赛(k为2^k<=n中k的最大值),下一轮晋级人数是本轮每场比赛的获胜者,还得加上n-k个人

求全部比赛完毕后所须要的水的数量和毛巾的数量

注: 如有疑问,请下方评论,本人一定具体解答

#include <bits/stdc++.h>

using namespace std;

int main()
{
int n,b,p;
while(~scanf("%d%d%d",&n,&b,&p))
{
int ans_p = n * p;
int ans_b = 0;
while(n!=1)
{
int tt = (int )(log(n)/log(2));
int k = pow(2,t);
int d = n - k;
ans_b += (2*b+1) * (k/2);
n = k/2 + d;
}
printf("%d %d\n",ans_b,ans_p);
}
return 0;
}

Codeforces Educational Codeforces Round 8 A. Tennis Tournament的更多相关文章

  1. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...

  2. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://code ...

  3. Educational Codeforces Round 8 A. Tennis Tournament 暴力

    A. Tennis Tournament 题目连接: http://www.codeforces.com/contest/628/problem/A Description A tennis tour ...

  4. Codeforces CF#628 Education 8 A. Tennis Tournament

    A. Tennis Tournament time limit per test 1 second memory limit per test 256 megabytes input standard ...

  5. codeforces Educational Codeforces Round 5 A. Comparing Two Long Integers

    题目链接:http://codeforces.com/problemset/problem/616/A 题目意思:顾名思义,就是比较两个长度不超过 1e6 的字符串的大小 模拟即可.提供两个版本,数组 ...

  6. codeforces Educational Codeforces Round 16-E(DP)

    题目链接:http://codeforces.com/contest/710/problem/E 题意:开始文本为空,可以选择话费时间x输入或删除一个字符,也可以选择复制并粘贴一串字符(即长度变为两倍 ...

  7. Codeforces Educational Codeforces Round 15 E - Analysis of Pathes in Functional Graph

    E. Analysis of Pathes in Functional Graph time limit per test 2 seconds memory limit per test 512 me ...

  8. Codeforces Educational Codeforces Round 15 D. Road to Post Office

    D. Road to Post Office time limit per test 1 second memory limit per test 256 megabytes input standa ...

  9. Codeforces Educational Codeforces Round 15 C. Cellular Network

    C. Cellular Network time limit per test 3 seconds memory limit per test 256 megabytes input standard ...

随机推荐

  1. map循环遍历

    data.map(function(item){ item.show = false; //将拿到的data循环给每一项添加show属性 });

  2. java实现websocket 终极指南

    大概思路:  首先用户登陆  获取用户信息存储到httpsession中,然后客户端链接服务端websocket,首先HandshakeInterceptor这个拦截器会拦截请求 调用 beforeH ...

  3. iptables 配置端口及转发

    iptables端口转发指令:iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 8443 iptables配 ...

  4. vsftpd服务程序的三种认证模式

    vsftpd服务程序的三种认证模式的配置方法——匿名开放模式.本地用户模式以及虚拟用户模式.了解PAM可插拔认证模块的原理.作用以及实战配置方法,通过实战课程进一步继续学习SELinux服务的配置方法 ...

  5. 一、奇妙插件Tampermonkey的简单安装教程

    奇妙插件Tampermonkey的简单安装教程 1.下载 对于浏览器而言,一般的功能并不能满足"特殊用户的需求".这时候就须要插件来帮忙了.那么讲到插件的支持多又常见的浏览器必定要 ...

  6. NSURLCache、网络监測状态

    有时候.对同一个URL请求多次.返回的数据可能一样的: 比方server上的某张图片.不管下载多少次,返回的数据都是一样的.可是这些情况会造成下面问题: 1,用户流量的浪费. 2.程序响应速度不够快 ...

  7. nj05---模块

    概念:模块(Module)和包(Package)是Node.js最重要的支柱.在浏览器JavaScript中,脚本模块的拆分和组合通常使用HTML的script标签来实现,Node.js提供了requ ...

  8. 2.LINUX常用命令

    Linux 必备指令摘要一般用户指令/bin 指令 功能说明 范例 bash GNU Bouren-Again Shell bash shell_script cat 观看一般文本文件 cat fil ...

  9. SharePoint 第一个网站

    第一个网站 1.建立一个社区门户网站首先要建一个IIS网站,并且把匿名访问勾选上,这样才能真正的访问网站. 创建网站的时候更改自己想要的端口,以便操作 这里更改网站是否启用匿名访问权限.点击是 然后保 ...

  10. ui5 call view or method from another view

    // call view or method from another view //# view call // var view2=sap.ui.jsview("ui5d.popup01 ...