C语言100天练习题【记录本】

C语言经典100题(手把手 编程)

可以在哔哩哔哩找到

已解决的天数:一,二,五,六

下面的都是模模糊糊的

可以学学这些算法,我是算法白痴,但是我不是白痴,可以学!

第三天(未解决)

第四天

cs 复制代码
#include <stdio.h>

// 判断是否为闰年
int isLeapYear(int year) {
    return (year % 4 == 0 && year % 100!= 0) || (year % 400 == 0);
}

int main() {
    int year, month, day;
    int days_in_month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int total_days = 0;

    printf("请输入年月日:");
    scanf("%d %d %d", &year, &month, &day);

    // 判断闰年,更新二月天数
    if (isLeapYear(year)) {
        days_in_month[1] = 29;
    }

    // 计算天数
    for (int i = 0; i < month - 1; i++) {
        total_days += days_in_month[i];
    }
    total_days += day;

    printf("这是第%d天\n", total_days);

    return 0;
}
相关推荐
是Yu欸7 分钟前
鸿蒙PC移植:2048 从网页小游戏到 AI 桌面应用
大数据·人工智能·算法·数据挖掘·openharmony·codex
鹿角片ljp17 分钟前
KV Cache 解析
java·算法
liliangcsdn35 分钟前
IVOL与偏度因子的对比测量分析
算法
free-elcmacom1 小时前
C语言字符指针与字符串字面量——从一道“剑指 Offer”笔试题说起
c语言·visual studio
threerocks2 小时前
Jev 入门第一课
算法
西柚研究生1234563 小时前
论文分析17:YOLOv11_UAVNet:无人机航拍图像专用目标检测算法
人工智能·python·深度学习·算法·目标检测
hetao17338373 小时前
2026-09-17 hetao1733837 的刷题记录
c++·算法
午彦琳4 小时前
2026.9.17
数据结构·算法·leetcode
木井巳5 小时前
【记忆化搜索】不同路径
java·算法·leetcode·深度优先·剪枝·推荐算法
怕浪猫6 小时前
从 Windows 换到 Mac 三个月,我真香了
算法·面试·架构