跳至内容

ntzyz's blog

  • 笔记
  • 计算机
  • 计算器
  • 杂类
  • 坑

Links

About me
Another blog
Minecraft
JerryFu's Blog
Yuno's Wonderland
notonokodds
Raki Daroney
春上冰月的博客
初春 · 姫
>Lithia's Core
ZephRay
kasora's blog
徐靖峰 | 个人博客
Test2g
447f.Misaka
Project RC
Shell Bin

标签: 模拟

[HDU1008] Elevator

题目很简单,一次就能A,把代码拉过来测试一下语法高亮~

#include 

int main() {
    int n;
    while (std::cin >> n) {
        if (!n)
            return 0;
        int currFloor = 0;
        int sum = 0, aim;
        while (n--) {
            std::cin >> aim;
            sum += ((currFloor > aim) ? (4) : (-6)) * (currFloor - aim) + 5;
            currFloor = aim;
        }
        std::cout << sum << std::endl;
    }

    return 0;
}
发布于 2015年8月6日2016年5月20日分类 杂类标签 ACM、HDU、模拟于[HDU1008] Elevator留下评论
自豪地采用WordPress