记录解题过程。 摘要:解题思路: 注意事项:参考代码:#include<bits/stdc++.h>using namespace std;int main(){ double x1, x2,x3,x4; d…… 题解列表 2023年02月23日 0 点赞 0 评论 552 浏览 评分:0.0
自由下落的距离计算 好理解的思路(C语言) 解题思路:由题目知,该题要运用等比数列,an=a1*q^(n-1),Sn=a1(1-q^n)/(1-q),先假设高度为1米,a1=1,q=0.5,要求第n次下落后再弹起的高度,也就是第a(n+1)项,先求出an=(1/2)^(n-1),所以a(n+1)=(1/2)^n, 题解列表 2023年02月23日 0 点赞 1 评论 520 浏览 评分:9.9
编写题解 2799: 奥运奖牌计数 摘要:解题思路:sum的用法注意事项:参考代码:#include<iostream>using namespace std;int main(){ int n; cin>>n; int a[n]…… 题解列表 2023年02月23日 0 点赞 0 评论 515 浏览 评分:6.0
C语言链表解法 摘要:解题思路:注意事项:参考代码:#include<stdio.h> typedef struct Link{ int data; struct Link *next; }Link; //循…… 题解列表 2023年02月23日 0 点赞 0 评论 583 浏览 评分:0.0
前缀和 + 二分 #前缀和+二分先看测试数据范围10^5,暴力会TLE。先将每个人刷题的数量保存,并且更新最多刷题数量`sum[i]`来存放刷题数目不超过i个人数,因此可以得到公式比我卷的人`more=n-sum[nums[i]]`比我躺的人`less=sum[nums[i]-1]`当moreless也就是说卷过我的人 题解列表 2023年02月23日 0 点赞 0 评论 988 浏览 评分:9.4
编写题解 2788: 晶晶赴约会 摘要:解题思路:用if语句借此题注意事项:只是1,3,5输出No,6,7也输出yes参考代码:#include<iostream>using namespace std;int main(){ int…… 题解列表 2023年02月23日 0 点赞 0 评论 523 浏览 评分:9.9
2839: 石头剪刀布(Python) 摘要:解题思路:注意事项:参考代码:N,NA,NB = map(int,input().split()) la = list(map(int,input().split())) lb = list(ma…… 题解列表 2023年02月23日 0 点赞 0 评论 772 浏览 评分:9.5
1042: [编程入门]电报加密 #此题和上一题类似,也需要接收空格,同时还需要进行字母加密,难度稍高。```cpp#include#include#includeusingnamespacestd;/*题目描述输入一行电报文字,将字母变成其下一字母(如’a’变成’b’……’z’变成’a’其它字符不变)。 题解列表 2023年02月23日 0 点赞 1 评论 505 浏览 评分:9.9
1196: 去掉空格 #这个代码是适配一次性输入的代码,对于dev或者vs等运行环境一行一行输入的话可能会出现输入一次转换一次的问题,稍微改进即可。```cpp#include#include#includeusingnamespacestd;intmain(){charstr[101];while(cin.getline 题解列表 2023年02月23日 0 点赞 1 评论 446 浏览 评分:9.9
1124: C语言训练-大、小写问题 #这个题有点意思,测试字符串里面有空格的话容易出错,还特意强调了回车表示结束,所以空格结束的情况也需要排除掉。```cpp#include#include#includeusingnamespacestd;intmain(){charstr[101];cin.getline(str, 题解列表 2023年02月23日 0 点赞 1 评论 295 浏览 评分:6.0