• hud 4011 作业


    #include <iostream>
    #include <vector>
    #include <algorithm>
    #include <string>
    #include <set>
    #include <queue>
    #include <map>
    #include <sstream>
    #include <cstdio>
    #include <cstring>
    #include <numeric>
    #include <cmath>
    #include <iomanip>
    #include <deque>
    #include <bitset>
    #include <cassert>
    //#include <unordered_set>
    //#include <unordered_map>
    #define ll              long long
    #define pii             pair<int, int>
    #define rep(i,a,b)      for(int  i=a;i<=b;i++)
    #define dec(i,a,b)      for(int  i=a;i>=b;i--)
    #define forn(i, n)      for(int i = 0; i < int(n); i++)
    using namespace std;
    int dir[4][2] = { { 1,0 },{ 0,1 } ,{ 0,-1 },{ -1,0 } };
    const long long INF = 0x7f7f7f7f7f7f7f7f;
    const int inf = 0x3f3f3f3f;
    const double pi = acos(-1.0);
    const double eps = 1e-6;
    const int mod = 1e9 + 7;
    
    inline ll read()
    {
        ll x = 0; bool f = true; char c = getchar();
        while (c < '0' || c > '9') { if (c == '-') f = false; c = getchar(); }
        while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
        return f ? x : -x;
    }
    inline ll gcd(ll m, ll n)
    {
        return n == 0 ? m : gcd(n, m % n);
    }
    void exgcd(ll A, ll B, ll& x, ll& y)
    {
        if (B) exgcd(B, A % B, y, x), y -= A / B * x; else x = 1, y = 0;
    }
    inline int qpow(int x, ll n) {
        int r = 1;
        while (n > 0) {
            if (n & 1) r = 1ll * r * x % mod;
            n >>= 1; x = 1ll * x * x % mod;
        }
        return r;
    }
    inline int inv(int x) {
        return qpow(x, mod - 2);
    }
    ll lcm(ll a, ll b)
    {
        return a * b / gcd(a, b);
    }
    /**********************************************************/
    const int N = 1e5 + 5;
    
    int main()
    {
        int T;
        cin >> T;
        for(int q=1;q<=T;q++)
        {
            ll n, a, b;
            cin >> n >> a >> b;
            vector<ll> v(n + 1);
            rep(i, 1, n)
                scanf("%lld",&v[i]);
            ll res = 0;
            rep(i, 1, n-1)
            {
                res += min((v[i + 1] - v[i]-1ll) * b, 2 * a);
            }
            res += 2 * a + b*n;
            printf("Case #%lld: %lld
    ", q, res);
        }
        return 0;
    }
  • 相关阅读:
    Linux BFS简介
    汇编语言学习——第二章 寄存器(CPU工作原理)
    _WSAStartup@8,该符号在函数 _main 中被引用
    javascript中处理引号编码&#034;
    tornado+ansible+twisted+mongodb操作和维护系统开发自己主动(一个)
    ORA-00600: internal error code, arguments: [4194], [53], [41], [], [], [], [], []
    【leetcode】Valid Palindrome
    开源 自由 java CMS
    创建分和生日比较数组
    有关动态多维数组的一个问题
  • 原文地址:https://www.cnblogs.com/dealer/p/13594335.html
Copyright © 2020-2023  润新知