zoukankan      html  css  js  c++  java
  • 【NOIP2005】【Luogu1052】过河

    problem

    占坑待填

    solution

    占坑待填???

    codes

    //交前%一下, 送你80分
    #include<iostream>
    #include<algorithm>
    using namespace std;
    const int maxn = 30000010;
    #define mod 23301
    int l, s, t, m, a[maxn], f[maxn], cnt;
    int main(){
        ios::sync_with_stdio(false);
        cin>>l>>s>>t>>m;
        for(int i = 1; i <= m; i++){
            int x;  cin>>x;  a[x%mod] = 1;
            if(s==t&&x%s==0)cnt++;//s==t的特判
        }
        if(s==t){cout<<cnt<<"
    ";return 0;}
        for(int i = 1; i <= mod; i++)f[i]=0xffffff;
        for(int i = 1; i <= mod; i++){
            for(int j = s; j <= t; j++){
                if(i>=j)f[i] = min(f[i],f[i-j]+a[i%mod]);
            }
        }
        cout<<f[mod]<<"
    ";
        return 0;
    }
  • 相关阅读:
    doker基础用法
    docker容器技术基础入门
    流模式
    装饰器模式
    适配器模式
    组合模式
    桥接模式
    观察者模式
    注册模式
    模板模式
  • 原文地址:https://www.cnblogs.com/gwj1314/p/9444849.html
Copyright © 2011-2022 走看看