2013長沙網路賽 E題(水題 有點小bug)
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.0 Sunday 300 5.0
Sample Output
Thursday Monday
#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長沙網路賽H題Hypersphere (蛋疼的題目 神似邀請賽A題)
- 2013成都網路賽 兩個簡單題
- 2013杭州網路賽C題HDU 4640(模擬)
- 2014鞍山網路賽 E題||hdu 5001 概率dp
- [BUG反饋]username欄位的長度設定有點小問題。
- 賽題要點
- 公司網路有問題
- 2013成都網路賽1004題HDU 4731Minimum palindrome (思維題目)
- YTU-OJ-Problem E: AB程式設計題--世界盃小組賽程式設計
- 2024ccpc網路賽補題
- 2020長沙網路安全·智慧製造大會在長沙召開
- hdu5445 || 2015長春網路賽1009題 多重揹包問題
- 做題小計 arc172e
- 【構造共軛函式+矩陣快速冪】HDU 4565 So Easy! (2013 長沙賽區邀請賽)函式矩陣
- 2018 徐州網路賽 G 題解
- 除了效能縮水還有啥問題?盤點iOS升級的大坑iOS
- 第三屆華中地區邀請賽網路賽題解
- 重啟系統,網路有問題
- 千鋒長沙前端培訓:Vue相關面試題前端Vue面試題
- 高校戰“疫”網路安全分享賽-部分PWN題-wp
- [BUG反饋]基礎模型有個小BUG,當新增目錄的時候點選標題進入不了下一級模型
- 網路安全常見問題有哪些?網路安全學習
- 奧運火炬長沙傳遞路線
- 長沙Java培訓機構面試題:專案實操Java面試題
- 從Linux 2.6.8核心的一個TSO/NAT bug引出的網路問題排查觀點Linux
- 關於網路的一點問題(轉)
- hdu5452 || 瀋陽網路賽1003題 最近公共祖先問題
- 2024ICPC網路賽第一場題解(部分)
- 網頁開發者模式 陷入無限斷點(Debugger)的問題網頁模式斷點
- 美團網2014校招筆試題及解答(長沙站+哈爾濱站)薦筆試
- 2013 ACM/ICPC Asia Regional Online —— Warmup2 兩個水題ACM
- 3 月水題練習
- XCTF高校網路安全專題挑戰賽丨HarmonyOS和HMS專場真題提前曝光?!
- 2013杭州網路賽D題HDU 4741(計算幾何 解三元一次方程組)
- 工控行業進入網路安全問題爆發期,有6點需要關注行業
- 有做網路的小夥伴嗎
- linux掛載網路儲存mount有問題Linux
- Thread 還有點問題thread