编写题解 2810: 鸡尾酒疗法 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int n=0; scanf("%d&…… 题解列表 2025年12月25日 0 点赞 0 评论 377 浏览 评分:0.0
C语言训练-计算1~N之间所有奇数之和 摘要:解题思路:便利1~n中所有数,用i%2==1筛选所有奇数,再累加到总和注意事项:sum初值为0参考代码:#include<stdio.h>int main(){ …… 题解列表 2025年12月25日 0 点赞 0 评论 471 浏览 评分:0.0
循环实现斐波那契数列or递归函数 解题思路:注意事项:参考代码:方法一:循环(推荐)#includeintmain(){intk;scanf("%d",&k);longlongn1=1,n2=1;//初始化前两项:f1=第1项,f2=第2项longlongnk=0;//处理边界情况:k=1或k=2, 题解列表 2025年12月24日 0 点赞 0 评论 504 浏览 评分:0.0
2845: 求10000以内n的阶乘 解题思路:用字符串或者数组都可以,但我觉得数组更好理解,虽然大部分同学都是用字符串写的。注意事项:直接看代码注释,主要注意处理进位问题和前导0,其他的和普通阶乘没什么区别参考代码:#include#defineMAX40000intmain(){intn;scanf("%d", 题解列表 2025年12月24日 2 点赞 0 评论 381 浏览 评分:10.0
C语言最详解之程序员买房子 摘要:解题思路:核心逻辑:逐年模拟与判断循环限制:year < 20保证最多模拟 20 年,符合题目要求;年薪积累:每年先执行savings += N,表示第year年结束后,程序员积攒了…… 题解列表 2025年12月24日 2 点赞 0 评论 462 浏览 评分:0.0
数的计数(Noip2001) 摘要:#include <stdio.h>int main() { int n; scanf("%d", &n);…… 题解列表 2025年12月24日 0 点赞 0 评论 330 浏览 评分:0.0
3030: 全排列 解题思路:注意事项:参考代码:#include#includecharstr[10];charres[10];intused[10]={0};intlen;voidfun(intx){if(x==len){res[len]='\0';printf( 题解列表 2025年12月24日 0 点赞 0 评论 314 浏览 评分:0.0
获取n个斐波那契数列 摘要:解题思路:通过for循环来达到只获取n个斐波那契数列注意事项:参考代码:#include<stdio.h>#define N 40int fblq(int x){ …… 题解列表 2025年12月24日 0 点赞 0 评论 408 浏览 评分:0.0
循环累乘法实现复利 解题思路:注意事项:百分数要转换成小数参考代码:#include#includeintmain(){intR=0,M=0,Y=0;scanf("%d%d%d",&R,&M,&Y);doublemoney=(double)M;//计算年增长系数:(1+R/100.0), 题解列表 2025年12月24日 0 点赞 0 评论 283 浏览 评分:0.0
pow函数实现复利增长公式 解题思路:注意事项:Pn=P0*(1+r)^n(复利增长公式)参考代码:#include#includeintmain(){intx=0,n=0;scanf("%d%d",&x,&n);doublegrowth_factor=pow(1+0.001, 题解列表 2025年12月24日 0 点赞 0 评论 309 浏览 评分:0.0