大致题意:

网球比赛,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. 使用maven插件dockerfile-maven-plugin生成Docker镜像并推送到镜像仓库

    1.引入maven插件 <build> <plugins> <plugin> <groupId>com.spotify</groupId> ...

  2. laravel 5.5 项目报错

    报错内容: ErrorException (E_WARNING) Declaration of App\Observers\SiteObserver::updated($site) should be ...

  3. HDU Integer's Power(容斥原理)

    题意 求[l,r]的最大指数和(1<=l,r<=10^18) 最大指数和(如64=8^2=4^3=2^6,所以64的最大指数和是6) 题解 很明显我们可以先求出[1,n]的最大指数和,然后 ...

  4. 【CS-4476-project 6】Deep Learning

    AlexNet / VGG-F network visualized by mNeuron. Project 6: Deep LearningIntroduction to Computer Visi ...

  5. 【codeforces 131E】Yet Another Task with Queens

    [题目链接]:http://codeforces.com/problemset/problem/131/E [题意] 给你n*n坐标上的m个皇后的位置; 然后让你求出,能够攻击到0,1,2-8个其他皇 ...

  6. mysql-高级语言语法

    一.注释 从#字符到行尾 从'-- '序列到行尾.两个破折号之后至少要有一个空格符或制表符. 二.设置变量 用户变量的形式为@var_name,其中变量名varname可以有当前字符集的文字数字字符. ...

  7. Ryu基本操作的REST API调用演示样例

    import urllib2 import json def get_all_switches(): url = "http://127.0.0.1:8080/v1.0/topology/s ...

  8. LintCode-赋值运算符重载

    实现赋值运算符重载函数.确保: 新的数据可准确地被复制 旧的数据可准确地删除/释放 可进行 A = B = C 赋值 您在真实的面试中是否遇到过这个题? Yes 例子 假设进行 A = B 赋值.则 ...

  9. reverse(两种反向生成url django原生形式和rest_framework中版本的形式)

    reverse(两种反向生成url django原生形式和rest_framework中版本的形式) views.py from django.shortcuts import render,Http ...

  10. Python开源爬虫项目代码:抓取淘宝、京东、QQ、知网数据--转

    数据来源:数据挖掘入门与实战  公众号: datadw scrapy_jingdong[9]- 京东爬虫.基于scrapy的京东网站爬虫,保存格式为csv.[9]: https://github.co ...