UVa11958 - Coming Home

简介: UVa11958 - Coming Home
#include <cstdio>#include <climits>usingnamespacestd;
constintN=110;
constintDAY=24*60;
structBus{
intarriveTime, travelTime;
};
Busbus[N];
intn, curTime;
boolinput();
intsolve();
intmain()
{
#ifndef ONLINE_JUDGEfreopen("d:\\OJ\\uva_in.txt", "r", stdin);
#endifintt;
scanf("%d", &t);
for (inti=1; i<=t; i++) {
input();
printf("Case %d: %d\n", i, solve());
    }
return0;
}
boolinput()
{
inth, m;
scanf("%d %d:%d", &n, &h, &m);
curTime=h*60+m;
for (inti=0; i<n; i++) {
scanf("%d:%d %d", &h, &m, &bus[i].travelTime);
bus[i].arriveTime=h*60+m;
    }
returntrue;
}
intsolve()
{
intans=INT_MAX;
for (inti=0; i<n; i++) {
if (curTime>bus[i].arriveTime) {
bus[i].arriveTime+=DAY;
        }
intcost=bus[i].arriveTime-curTime+bus[i].travelTime;
if (cost<ans) ans=cost;
    }
returnans;
}
目录
相关文章
UVa355 - The Bases Are Loaded
UVa355 - The Bases Are Loaded
56 0
UVa11565 - Simple Equations
UVa11565 - Simple Equations
58 0
UVa389 - Basically Speaking
UVa389 - Basically Speaking
43 0
ZOJ - Summer 2018 - Contest 2 by Astolfo - Problems - 1002: Hazard and The Triangle
ZOJ - Summer 2018 - Contest 2 by Astolfo - Problems - 1002: Hazard and The Triangle
118 0
ZOJ - Summer 2018 - Contest 2 by Astolfo - Problems - 1002: Hazard and The Triangle
ZOJ - Summer 2018 - Contest 1 by SBconscious - Problems - 1001: Saber
ZOJ - Summer 2018 - Contest 1 by SBconscious - Problems - 1001: Saber
107 0
uva live 3516 - Exploring Pyramids
点击打开链接 题意:给出一棵多叉树,每个结点的任意两个子节点都有左右之分。从根节点开始,每次尽量往左走,走不通就回溯,把遇到的字母顺序记录下来,可以得到一个序列。
786 0