zoukankan      html  css  js  c++  java
  • BZOJ1740: [Usaco2005 mar]Yogurt factory 奶酪工厂

    n<=10000天每天Ci块生产一东西,S块保存一天,每天要交Yi件东西,求最少花多少钱。

    这个我都不知道归哪类了。。

     1 #include<stdio.h>
     2 #include<string.h>
     3 #include<stdlib.h>
     4 #include<algorithm>
     5 //#include<iostream>
     6 using namespace std;
     7 
     8 int n,m;
     9 #define maxn 10011
    10 int a,b;
    11 #define LL long long
    12 int main()
    13 {
    14     scanf("%d%d",&n,&m);LL Min=1e15,ans=0;
    15     for (int i=1;i<=n;i++)
    16     {
    17         scanf("%d%d",&a,&b);
    18         a-i*m<Min && (Min=a-i*m);
    19         ans+=(Min+i*m)*b;
    20     }
    21     printf("%lld
    ",ans);
    22     return 0;
    23 }
    View Code
  • 相关阅读:
    高级排序
    递归
    Linked List
    中缀、后缀、前缀表达式
    队列(queue)
    栈(Stack)
    数组(Array)
    数据结构和算法
    常见排序
    开启
  • 原文地址:https://www.cnblogs.com/Blue233333/p/7522437.html
Copyright © 2011-2022 走看看