zoukankan      html  css  js  c++  java
  • 1008. Elevator

    C++语言: Codee#25856
    01 /*
    02 +++++++++++++++++++++++++++++++++++++++
    03                 author: chm
    04 +++++++++++++++++++++++++++++++++++++++
    05 */
    06
    07 #include <map>
    08 #include <set>
    09 #include <list>
    10 #include <queue>
    11 #include <cmath>
    12 #include <stack>
    13 #include <bitset>
    14 #include <cstdio>
    15 #include <cctype>
    16 #include <string>
    17 #include <vector>
    18 #include <cassert>
    19 #include <cstdlib>
    20 #include <cstring>
    21 #include <fstream>
    22 #include <sstream>
    23 #include <iomanip>
    24 #include <iostream>
    25 #include <algorithm>
    26
    27 using namespace std;
    28
    29 FILE*            fin         = stdin;
    30 FILE*            fout         = stdout;
    31 const int        max_size     = 10086;
    32 #define ONLINE_JUDGE
    33 int main()
    34 {
    35 #ifndef ONLINE_JUDGE
    36     freopen("d:\\in.txt", "r", stdin);
    37     freopen("d:\\out.txt", "w", stdout);
    38 #endif
    39     int n;
    40     int tmp;
    41     int cur = 0;
    42     int cost = 0;
    43     scanf("%d", &n);
    44     while(n--)
    45     {
    46         scanf("%d", &tmp);
    47         if(tmp > cur)
    48             cost += (tmp - cur) * 6;
    49         else
    50             cost += (cur - tmp) * 4;
    51         cur = tmp;
    52         cost += 5;
    53     }
    54     printf("%d\n", cost);
    55
    56 #ifndef ONLINE_JUDGE
    57     fclose(stdout);
    58     system("start d:\\check.exe d:\\out.txt d:\\ans.txt");
    59 #endif
    60     return 0;
    61 }
  • 相关阅读:
    vue-router路由
    前端路由与后端路由
    getsupportfragmentmanager 没有这个方法
    Glide使用
    Android使用Glide加载Gif.解决Glide加载Gif非常慢问题
    电脑卡,eclipse Android stadio 卡,什么都卡解决方法
    Service IntentService区别 (面试)
    枚举
    Android stadio litepal
    Android 单元测试
  • 原文地址:https://www.cnblogs.com/invisible/p/2402899.html
Copyright © 2011-2022 走看看