2013长沙网络赛 E题(水题 有点小bug)
来源:互联网 发布:php资源网源码 编辑:程序博客网 时间:2024/04/30 09:10
Recently, Fancy is invited by his best friend to make a trip to his new house. Fancy is really excited by the invitation, so he's going to start the trip as soon as possible. But there are several difficulties to overcome. First, his friend is living in Changsha and Fancy is living in Hangzhou, so the trip is really a long one. Second, Fancy has only a bike to make this trip. Third, Fancy is a strange guy who would never work for longer than 8 hours on weekdays, and he would never work for longer than 4 hours on the weekend.
During this trip, Fancy thinks that riding bike is his only work. So on days of Monday to Friday, he will ride his bike 8 hours at most, and on Saturday and Sunday, he will ride 4 hours at most. Obviously, he will finish the trip as early as possible.
Now Fancy is going to start the trip, with information of road length and his riding speed, he wants to know that what day is his arriving day.
Input
There'll be several test cases. For each test case, there will be a string startday (startday ∈ {'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'}), an integerL (100 ≤ L ≤ 1000000000) and a float number s (5 ≤ s ≤ 30, with at most 3 decimal points). Here startday is the day which Fancy start the trip, L is the total length of the trip (in kilometer) and s is Fancy's riding speed (kilometer per hour).
Output
For each test case, please print the earlist day called arriveday which Fancy will arrive at Changsha. Please note that your output should fulfill arriveday ∈ {'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'}.
Sample Input
Monday 800 25.0Sunday 300 5.0
Sample Output
ThursdayMonday
#include<iostream>#include<cstring>#include<cmath>#include<cstring>#include<cstdio>#include<algorithm>#include<map>using namespace std;double eps=0.0001;char a[7][20]= {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};int main(){ char s[20]; double l,v; //距离与一小时的速度 double weekv,eiv,fouv; //一周的路程,八小时的路程,四小时的路程 int i,sta; while(~scanf("%s%lf%lf",s,&l,&v)) { for(i=0; i<7; i++) if(strcmp(a[i],s)==0) { sta=i; break; } weekv=48.0*v,eiv=8.0*v,fouv=4.0*v; int len=l/weekv; l-=len*weekv; if(l==0) sta=(sta-1+7)%7; //说明一个回合过来了,好不容易找出来的bug else { while(l>=0) { if(sta>=0&&sta<=4) //周一到周五可以走到 { if(l<=eiv) break; l-=eiv; //周一到周五不能走到 sta=(sta+1)%7; } else { if(l<=fouv) //周六到周日可以走到 break; l-=fouv; sta=(sta+1)%7; //周六到周日不能走到 } } } cout<<a[sta]<<endl; } return 0;}
- 2013长沙网络赛 E题(水题 有点小bug)
- 2013长沙网络赛 C题(模拟题)
- 2013 ACM/ICPC 长沙网络赛B题解题报告
- 2013 长沙网络赛 B 题 Bizarre Routine
- 2013长沙网络赛 G Goldbach
- 2013 ACM/ICPC 长沙网络赛-Goldbach
- 2013 ACM/ICPC 长沙网络赛-Candies
- 2013 ACM/ICPC 长沙网络赛-Goldbach
- 2013长沙网络赛G Goldbach
- 2013长沙网络赛G Goldbach FFT
- 2013regional长沙赛区网赛E题--Travel by Bike
- 长沙邀请赛E题解题报告
- HDU 4569 长沙E题 枚举
- 2013长沙网络赛H题Hypersphere (蛋疼的题目 神似邀请赛A题)
- 2013长沙网络赛J题 Candies(差分约束或数学规律)#by zh
- 2013长沙网络赛 G Goldbach (FFT)
- 2013长沙网络赛 - J - Candies(不等式)
- 2013 ACM/ICPC 长沙网络赛 J Candies (ZOJ)
- 阿里2014笔试题
- Linux ALSA声卡驱动之七:ASoC架构中的Codec
- CSS中display:block的作用
- 正则表达式
- 《C++程序设计语言》7.10_9 简单C++加密程序
- 2013长沙网络赛 E题(水题 有点小bug)
- 北大ACM1730Perfect Pth Powers总结
- c 语言第一课
- 黑马程序员 java知识点分享_异常
- 模板模式
- Linux File Sharing in a Microsoft Active Directory Domain
- Android开发者不可或缺的四大工具
- Android数据库安全解决方案,使用SQLCipher进行加解密
- 二叉树