zoukankan      html  css  js  c++  java
  • M

    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;
    }
    View Code

    作者:YukiRinLL

    出处:YukiRinLL的博客--https://www.cnblogs.com/SutsuharaYuki/

    您的支持是对博主最大的鼓励,感谢您的认真阅读。

    本文版权归作者所有,欢迎转载,但请保留该声明。

  • 相关阅读:
    如何系统收集网页/电子书等相关的知识点
    针式PKM软件多个版本兼容功能的应用
    软件开发出路:做精某一卖点!
    深入针式PKM应用系列(1) 虚拟文件夹功能,让文件想放哪就放哪
    PKM软件:提供知识应用的工具支持
    解决长串英文字母显示不能自动换行的问题
    C#中判断字符串A中是否包含字符串B
    小技巧锦集
    解决Notes的"The remote server is not a known tcp/IP host"问题的方法
    将Sql Server自增长字段的目前识别值重调!
  • 原文地址:https://www.cnblogs.com/SutsuharaYuki/p/11950441.html
Copyright © 2011-2022 走看看