http://codeforces.com/gym/101775/problem/M

The 2018 World Cup will be hosted in Russia. 32 national teams will be divided into 8 groups. Each group consists of 4 teams. In group matches, each pair (unordered) of teams in the group will have a match. Top 2 teams with the highest score in each group will advance to eighth-finals. Winners of each eighth-final will advance to quarter-finals. Then, the winners of each quarter-final will advance to semi-finals. Eventually, the World Champion will be the winner of the World Final which is played between the two winners of the semi-finals.

Each match is labeled with a match ID sequenced from 1 to 63, with group matches followed by eighth-final matches followed by quarter-final matches followed by semi-finals matches and finally the final match.

Zhuojie is going to watch the 2018 World Cup. Since the World Champion of ACM-ICPC is very rich, he decides to spend 0.01% of his daily salary to buy tickets. However, there are only match IDs on the tickets and the prices are missing. Can you calculate how much Google pays Zhuojie every workday? Note that Zhuojie can buy multiple tickets for one match.

Input

The input starts with one line containing exactly one integer T, the number of test cases.

Each test case contains 3 lines. The first line contains 5 integers, indicating the ticket price for group match, eighth-final match, quarter-final match, semi-final match and the final match. The second line contains one integer N, the number of tickets Zhuojie buys. The third line contains N integers, each indicating the match ID on the ticket.

  • 1 ≤ T ≤ 100.
  • 1 ≤ N ≤ 105.
  • .
  • .

Output

For each test case, output one line containing "Case #x: y" where x is the test case number (starting from 1) and y is daily salary of Zhuojie.

Example

Input
1
11 12 13 14 15
2
1 49
Output
Case #1: 230000

代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<deque>
#include<iomanip>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include <vector>
#include <iterator>
#include <utility>
#include <sstream>
#include <limits>
#include <numeric>
#include <functional>
using namespace std;
#define gc getchar()
#define mem(a) memset(a,0,sizeof(a))
//#define sort(a,n,int) sort(a,a+n,less<int>()) #define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef char ch;
typedef double db; const double PI=acos(-1.0);
const double eps=1e-6;
const ll mod=1e9+7;
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
const int maxm=100+10; bool compare(int a, int b)
{
return a < b;//升序
} int main()
{
int t = 0;
int n , num;
int a , b , c , d , e;
int price[65] = {0};
cin >> t;
for(int j = 1;j<=t;j++)
{
int sum = 0;
scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
int i;
for(i=1 ;i<=48;i++)
{
price[i] = a;
}
for(i=49 ;i<=56;i++)
{
price[i] = b;
}
for(i=57 ;i<=60;i++)
{
price[i] = c;
}
for(i=61 ;i<=62;i++)
{
price[i] = d;
}
price[63] = e;
scanf("%d",&n);
for(i = 0;i<n;i++)
{
scanf("%d",&num);
sum+=price[num];
}
cout<<"Case #"<<j<<": "<<sum<<"0000"<<endl;
}
} make(ll n , ll k)
{
ll base = n;
ll sum = 0;
for(ll i = 1;i<=n;i++)
{
if(i >= k)
{
//cout<<base<<"!"<<endl;///
sum += base%1000000007;
sum = sum%1000000007;
}
base = base*(n-i)/(1+i)%1000000007;
}
return sum;
}

M - World Cup Gym - 101775M的更多相关文章

  1. 2017 ACM-ICPC EC-Final ShangHai 东亚洲大陆-上海

    比赛链接:传送门 Gym 101775A Chat Group(签到:待补) Gym 101775B Scapegoat(待补) Gym 101775C Traffic Light(贪心+思维) 思路 ...

  2. Gym 101194L / UVALive 7908 - World Cup - [三进制状压暴力枚举][2016 EC-Final Problem L]

    题目链接: http://codeforces.com/gym/101194/attachments https://icpcarchive.ecs.baylor.edu/index.php?opti ...

  3. 【GYM 102059】2018-2019 XIX Open Cup, Grand Prix of Korea

    vp了一场gym,我又开心地划水了. A. Coloring Roads 题意:给定一棵树,树边一开始都是无色的,每次操作可以把一个点到根的路径染成某个颜色,每次询问当前树上出现过某个次数的颜色种数. ...

  4. 2018-2019 XIX Open Cup, Grand Prix of Korea (Division 2) GYM 102058 F SG函数

    http://codeforces.com/gym/102058/problem/F 题意:平面上n个点  两个人轮流在任意两个点之间连一条线但是不能和已有的线相交,先围成一个凸多边形的获胜,先手赢还 ...

  5. Gym - 101194L World Cup 暴力

    World CupInput file: Standard InputOutput file: Standard OuptutTime limit: 1 second Here is World Cu ...

  6. Gym.102059: 2018-2019 XIX Open Cup, Grand Prix of Korea(寒假gym自训第一场)

    整体来说,这一场的质量比较高,但是题意也有些难懂. E.Electronic Circuit 题意:  给你N个点,M根线,问它是否是一个合法的电路. 思路:  一个合法的电路,经过一些串联并联关系, ...

  7. Gym - 102059D 2018-2019 XIX Open Cup, Grand Prix of Korea D. Dumae 贪心+堆

    题面 题意:有3e5个人排成一列,然后Li,Ri表示每个人可以站在[Li,Ri]中的一个,然后M(1e6)个限制条件,某个人一定要在某个人前面,求一种合法方案,无解输出-1 题解:首先可以想到对于限制 ...

  8. UVA 1394 And Then There Was One / Gym 101415A And Then There Was One / UVAlive 3882 And Then There Was One / POJ 3517 And Then There Was One / Aizu 1275 And Then There Was One (动态规划,思维题)

    UVA 1394 And Then There Was One / Gym 101415A And Then There Was One / UVAlive 3882 And Then There W ...

  9. [C++]Yellow Cards - GYM - 102348A(Practice *) - CodeForces

    1 Problem Description Problem The final match of the Berland Football Cup has been held recently. Th ...

  10. Petrozavodsk Summer-2016. Warsaw U Contest, XVI Open Cup Onsite.

    Petrozavodsk Summer-2016. Warsaw U Contest, XVI Open Cup Onsite. Problem A. Gambling Problem B. Colo ...

随机推荐

  1. 记人生第一次DIY装机之旅

    一.调研 想装一台个人工作站很久了,原因是大学自用的笔记本总是在使用过程中过热关机,导致做一些CPU负载较高的工作时总是中断而无法连贯进行.考虑到目前手头还有一个Surface 3在使用,再买一个笔记 ...

  2. Spring的一些常见面试题

    Spring八股文 源码解析 反射 1.谈谈spring ioc的理解,原理和实现? 总:两层意思:控制反转和容器. 控制反转:他是一种思想理论,原来的对象是由我们使用者自己来进行控制的,而有了spr ...

  3. VS2022 下载超详细安装教程(附安装包及秘钥):全能开发工具部署指南

    目录 一.VS2022软件核心功能与优势 二.VS2022下载及安装准备 1. 系统要求: 2. VS2022下载: 三.VS2022详细安装步骤 1. 解压VS2022安装包 2. 运行VS2022 ...

  4. 数栈V6.0全新产品矩阵发布,数据底座 EasyMR 焕新升级

    4月20日,袋鼠云成功举行了以"数实融合,韧性生长"为主题的2023春季生长大会.会上,袋鼠云自主研发的一站式大数据基础软件--数栈V6.0产品矩阵全新发布.对旗下大数据基础平台. ...

  5. Result Maps collection does not contain value for java.util.HashMap

    前言 查询报错 Result Maps collection does not contain value for java.util.HashMap 原因 SQL XML中包含此返回类型 解决 第一 ...

  6. 附录:LInux编辑器

    附录2:编辑器 1.vim 参考:菜鸟教程 1.1.安装 sudo apt install -y vim 1.2.常用指令 基本上 vi/vim 共分为三种模式,命令模式(Command Mode). ...

  7. 那些年拿过的shell之adminer

    扫敏感文件扫到一个adminer 第三次遇到了,先看版本4.2.5比较低可以利用mysql服务端读客户端文件漏洞(高版本修复了). 通过报错得到这个站是linux.虚拟主机.thinkphp3.绝对路 ...

  8. DotTrace系列:9. 大结局之 跨平台 和 自定义行为 诊断

    一:背景 1. 讲故事 本篇是系列的最后一篇,我们从跨平台部署和自定义诊断的角度跟大家聊一聊 dottrace,希望对大家有所启发. 二:跨平台和自定义诊断 1. 如何跨平台诊断分析 如果 dottr ...

  9. Manjaro/Arch 彻底解决 "Too many open files":为什么你改的 limits.conf 不生效

    问题现场 当你训练模型.处理大量文件或运行高并发服务时,突然出现: Failed creating file: ... [Too many open files] 你按照标准方案修改了 /etc/se ...

  10. CSP-S 2023 T1 题解

    CSP-S 2023 T1 题解 很简单,我们只需要暴力枚举五位密码,每次判断拨一个齿轮和两个齿轮能达到的状态数,如果等于 \(n\),答案 \(+1\).时间复杂度 \(O(10^5 \times ...