fork download
  1.  
Success #stdin #stdout 0.03s 9128KB
stdin
# 2026年 2月休假表 - 文字呈現版 (適合 Ideone)

def print_schedule():
    # 定義姓名與休假日期
    leaves = {
        "秀蘭": [4,7,9,11,13,16,18,19,21,22,25,26,28],
        "子硯": [3,6,7,10,14,15,16,17,20,21,24,28],
        "家和": [1,4,5,6,7,9,10,15,16,17,18,19,23,27],
        "宇翔": [1,2,3,8,9,14,16,17,18,19,20,26,27,28]
    }
    
    # 2026/2/1 是星期日
    weekdays = ["日", "一", "二", "三", "四", "五", "六"]
    dates = [f"{i}({weekdays[i % 7]})" for i in range(1, 29)]
    
    # 為了方便閱讀,拆分成兩段呈現 (1-14日, 15-28日)
    segments = [(0, 14), (14, 28)]
    
    for start, end in segments:
        current_dates = dates[start:end]
        print("-" * 100)
        # 標題行
        header = f"{'姓名 / 日期':<10}" + "".join([f"{d:>7}" for d in current_dates])
        print(header)
        print("-" * 100)
        
        # 每位員工行
        for name, leave_days in leaves.items():
            row = f"{name:<12}"
            for day_idx in range(start + 1, end + 1):
                mark = "V" if day_idx in leave_days else "-"
                row += f"{mark:>7}"
            print(row)
            
        # 統計行
        count_row = f"{'共休人數':<10}"
        for day_idx in range(start + 1, end + 1):
            count = sum(1 for person_days in leaves.values() if day_idx in person_days)
            # 標註 3 人以上同時休假
            display_count = f"*{count}*" if count >= 3 else str(count)
            count_row += f"{display_count:>7}"
        print(count_row)
        print("\n")

if __name__ == "__main__":
    print_schedule()
stdout
Standard output is empty