zoukankan      html  css  js  c++  java
  • Kattis

    这里写图片描述

    题意

    就是 有一堆容器,然后可以执行加的操作,每个容量是
    2, 3, 5, 7, 11, 13, 17, 19

    然后 有进位 比如第一个 容器,到2了,就会重置为0,然后 下一个容器+ 1, 但是要保证 最后一个容器 不大于等于 19 就可以
    算出 最多加多少次,从最低的容器开始加

    思路

    从后面往前推

    AC代码

    #include <cstdio>
    #include <cstring>
    #include <ctype.h>
    #include <cstdlib>
    #include <iostream>
    #include <algorithm>
    #include <cmath>
    #include <deque>
    #include <vector>
    #include <queue>
    #include <string>
    #include <map>
    #include <stack>
    #include <set>
    #include <numeric>
    #include <sstream>
    
    using namespace std;
    typedef long long LL;
    
    const double PI  = 3.14159265358979323846264338327;
    const double E   = 2.718281828459;
    const double eps = 1e-6;
    
    const int MAXN = 0x3f3f3f3f;
    const int MINN = 0xc0c0c0c0;
    const int maxn = 1e3 + 5;
    const int MOD  = 1e9 + 7;
    
    int n[] = {1, 2, 4, 6, 10, 12, 16, 18};
    int a[8];
    
    int main()
    {
        int num;
        memset(a, 0, sizeof(a));
        for (int i = 0; i < 8; i++)
            scanf("%d", &a[i]);
        int ans = n[7] - a[7];
        for (int i = 6; i >= 0; i--)
        {
            ans += (n[i] - a[i]) + ans * n[i];
        }
        cout << ans << endl;
    }
  • 相关阅读:
    p(str or array) 传递数据以易于阅读的样式格式化后输出 bootstarp样式的打印函数
    [Err] 1067
    php 正则表达式
    Docker使用及dnmp构建
    记一次Ubuntu18.04升级到19.10的经历
    面试-Redis
    ubuntu截图软件deepin scrot
    docker 搭建 Hadoop
    Docker 遇到的坑
    RabbitMQ遇到的坑
  • 原文地址:https://www.cnblogs.com/Dup4/p/9433283.html
Copyright © 2011-2022 走看看