2431: C语言习题 医生值班
Time Limit: 3 Sec Memory Limit: 128 MBSubmit: 1212 Solved: 322
[ Submit][ Status][ Web Board]
Description
医院内科有A,B,C,D,E,F,G,H共七位医生,每人在一周内要值一次夜班,排班的要求是:
(1) A医生值班日比C医生晚1天
(2) D医生值班日比E医生晚2天
(3) B医生值班日比G医生早3天
(4) F医生的值班日在B医生和C医生的值班日之间,且是星期四
请编写程序,输出每位医生的值班日。值班日以Sunday, Monday ,Tuesday, Wednesday, Thursday, Friday, Saturday分别表示星期日到星期六。
Input
无
Output
每位医生的值班日
Sample Input
Sample Output
you guess!
HINT
用枚举变量。
输出提示:
Doctor A is on duty Sunday.
Doctor B is on duty .
Doctor C is on duty .
Doctor D is on duty .
Doctor E is on duty .
Doctor F is on duty .
Doctor G is on duty . (别忘了每一行最后的点呦)
分析:枚举法
但仔细看看题目,就是一道简单的推理题,直接可以脑算出结果,输出即可。
省时又省力。
代码:
#include <stdio.h>
int main()
{
printf("Doctor A is on duty Sunday.\n");
printf("Doctor B is on duty Tuesday.\n");
printf("Doctor C is on duty Saturday.\n");
printf("Doctor D is on duty Wednesday.\n");
printf("Doctor E is on duty Monday.\n");
printf("Doctor F is on duty Thursday.\n");
printf("Doctor G is on duty Friday.");
return 0;
}