hdu_1036_Average is not Fast Enough_201311021335
Average is not Fast Enough!
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3436 Accepted Submission(s): 1348
You have to process several teams. For each team you are given a list with the running times for every section of the race. You are to compute the average time per kilometer over the whole distance. That's easy, isn't it? So if you like the fun and challenge competing at this contest, perhaps you like a relay race, too. Students from Ulm participated e.g. at the "SOLA" relay in Zurich, Switzerland. For more information visit http://www.sola.asvz.ethz.ch/ after the contest is over.
#include <stdio.h>
#include <string.h> char s[][];
int time[]; int main()
{
int N,n;
double d;
int num,i,j;
double res1;
int res2;
scanf("%d",&N);
scanf("%lf",&d);
memset(s,,sizeof(s));
while(scanf("%3d",&num)!=EOF)
{
int t=,totle=,k=;
//char h,m1,m2,s1,s2;
for(i=;i<N;i++)
{
getchar();
scanf("%s",s[i]);
//printf("%s\n",s[i]);
//scanf("%c:%c%c:%c%c",&h,&m1,&m2,&s1,&s2);
t=(s[i][]-'')*+(s[i][]-'')*+(s[i][]-'')*+(s[i][]-'')*+s[i][]-'';
//t=(h-'0')*3600+((m1-'0')*10+(m2-'0'))*60+(s1-'0')*10+(s2-'0');
if(t>)
{
totle+=t;
}
else
{
k=;
continue;
}
}
if(k==)
{
printf("%3d: -\n",num);
}
else
{
res2 = (int)totle*1.0/(d*);
res1 = (totle*1.0/(d*) - res2)*;
if(res1>=59.5)
{res2+=;res1=;}
printf("%3d:%2d:%02.0lf min/km\n",num,res2,res1);
}
}
//while(1);
return ;
}
网上不错的解法:
#include<stdio.h>
int main()
{
int n;
double d;
int num;
char h,m1,m2,s1,s2;
scanf("%d",&n);
scanf("%lf",&d);
while(scanf("%d",&num)!=EOF)
{ printf("%3d: ",num);
bool flag=true;
int sumtime=;
for(int i=;i<n;i++)
{getchar();
scanf("%c:%c%c:%c%c",&h,&m1,&m2,&s1,&s2);
if(h=='-') flag=false;
if(flag==false)continue;
sumtime+=(h-'')*+((m1-'')*+(m2-''))*+(s1-'')*+(s2-'');
}
if(flag==false)printf("-\n");
else
{
double t1=sumtime/d;
int t2=(int)(t1+0.5);
printf("%d:%02d min/km\n",t2/,t2%); }
}
return ;
}
总结:题比较简单,需认真读题弄明白题意,注意输入的格式
hdu_1036_Average is not Fast Enough_201311021335的更多相关文章
- opencv中的SIFT,SURF,ORB,FAST 特征描叙算子比较
opencv中的SIFT,SURF,ORB,FAST 特征描叙算子比较 参考: http://wenku.baidu.com/link?url=1aDYAJBCrrK-uk2w3sSNai7h52x_ ...
- 基于Fast Bilateral Filtering 算法的 High-Dynamic Range(HDR) 图像显示技术。
一.引言 本人初次接触HDR方面的知识,有描述不正确的地方烦请见谅. 为方便文章描述,引用部分百度中的文章对HDR图像进行简单的描述. 高动态范围图像(High-Dynamic Range,简称HDR ...
- Fast RCNN 训练自己的数据集(3训练和检测)
转载请注明出处,楼燚(yì)航的blog,http://www.cnblogs.com/louyihang-loves-baiyan/ https://github.com/YihangLou/fas ...
- Fast RCNN 训练自己数据集 (2修改数据读取接口)
Fast RCNN训练自己的数据集 (2修改读写接口) 转载请注明出处,楼燚(yì)航的blog,http://www.cnblogs.com/louyihang-loves-baiyan/ http ...
- 网格弹簧质点系统模拟(Spring-Mass System by Fast Method)附源码
弹簧质点模型的求解方法包括显式欧拉积分和隐式欧拉积分等方法,其中显式欧拉积分求解快速,但积分步长小,两个可视帧之间需要多次积分,而隐式欧拉积分则需要求解线性方程组,但其稳定性好,能够取较大的积分步长. ...
- XiangBai——【AAAI2017】TextBoxes_A Fast Text Detector with a Single Deep Neural Network
XiangBai--[AAAI2017]TextBoxes:A Fast Text Detector with a Single Deep Neural Network 目录 作者和相关链接 方法概括 ...
- 论文笔记--Fast RCNN
很久之前试着写一篇深度学习的基础知识,无奈下笔之后发现这个话题确实太大,今天发一篇最近看的论文Fast RCNN.这篇文章是微软研究院的Ross Girshick大神的一篇作品,主要是对RCNN的一些 ...
- [转]Amazon DynamoDB – a Fast and Scalable NoSQL Database Service Designed for Internet Scale Applications
This article is from blog of Amazon CTO Werner Vogels. -------------------- Today is a very exciting ...
- FAST特征点检测features2D
#include <opencv2/core/core.hpp> #include <opencv2/features2d/features2d.hpp> #include & ...
随机推荐
- frameset的target属性
使用frameset时的target属性 (2012-09-18 08:19:31) 转载▼ 分类: java技术之路 一般常用的有四个属性 _blank 浏览器总在一个新打开.未命名的窗口中载入 ...
- 数塔问题mod 100(orz)
看一下题目 和普通的数字三角形看似没啥区别(区别很大) 然后去想:DP方程 DP[i][j]=Max(DP[i-][j],DP[i-][j-])+a[i][j] ans=Max(DP[n][..n]) ...
- python自动化测试学习笔记-2-字典、元组、字符串方法
一.字典 Python字典是另一种可变容器模型,且可存储任意类型对象,如字符串.数字.元组等其他容器模型. 字典的每个键值(key=>value)对用冒号(:)分割,每个对之间用逗号(,)分割, ...
- 题解报告:hihoCoder #1174:拓扑排序·一
题目链接:https://hihocoder.com/problemset/problem/1174 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 由于今天上课的老师讲 ...
- [转]android使用全局变量的两种方法
本文转自:http://blog.csdn.net/feiyangxiaomi/article/details/9966215 在我们使用android编写程序的时候,少不了想利用全局变量,但是面向对 ...
- 生成错误:对路径".dll"的访问被拒绝
第一步:检查dll所在的目录的访问权限,右键文件夹>属性>安全>设置添加EveryOne用户并将完全控制的权限赋给它. 如果问题还没有解决,请不要一遍遍的重启,看第二步: 第二步:右 ...
- jenkinsfile or pipline 实现微服务自动发布回滚流程
1 #!/usr/bin/env groovy Jenkinsfile node { //服务名称 def service_name = "**" //包名 def service ...
- PDO访问其他数据库操作及作用
PDO的作用 PDO<!--数据访问抽象层--><!--1.可以访问其他数据库--><!--2.具有事务功能--><!--3.带有预处理语句功能(防止SQL注 ...
- 删除过期备份报错RMAN-06207 RMAN-06208解决方案
RMAN备份日志中出现了警告 日志文件目录如下: [root@erpdbs rmanback]# ll total 88 -rw-r--r-- 1 oraprod dba 81011 Sep 7 22 ...
- HTML CSS, JavaScript 计算器
效果图: 代码: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> < ...