题解列表

筛选

汽水瓶----最简单的解法(容易理解+详解)

摘要:解题思路:1、通过while循环来模拟兑换的过程2、用sum变量记录总共可兑换的瓶数3、一次循环就是进行一轮兑换4、本轮可进行兑换的空瓶子数n 除以3,就是本轮兑换到的瓶数,并加给n和sum5、再计算……

亲戚—并查集

摘要:题目要求我们将两个人合并为亲戚关系或输出一个人有多少个亲戚,很明显的是并查集操作 size[]数组存放的是每个根节点下面有几个亲戚,开始的时候每个人都是独立的所以每个根节点都初始化为1 ####解……

计算并联电阻的阻值

摘要:解题思路:注意事项:参考代码:r1,r2=map(float,input().strip().split())R = 1/(1/r1 + 1/r2)print("%.2f"%R)……

c++字符串简单解法

摘要:解题思路:注意事项:参考代码:#include<iostream> #include<algorithm>using namespace std;int main(){ int n,m; string……

最简洁的代码

摘要:def divisor_sum(n):     return sum(i for i in range(1, n) if n % i == 0) def is_True(a, b):     r……

求平方和简单写法

摘要:参考代码:#include<stdio.h>#include<math.h>int main(){ int a=3; int b=4;    scanf("%d%d",&a,&b);    print……

分段函数简单题解

摘要:参考代码:#include<stdio.h>#include<math.h>int main(){ int x,y=0; scanf("%d",&x); if(x<1) {     y=x;     ……

求一元二次方程

摘要:解题思路:注意事项:参考代码:#include<stdio.h>#include<math.h>int main(){    double a, b, c, x1=0, x2=0;    scanf(……

贪心快乐司机

摘要:解题思路:跟金银岛一样,https://blog.dotcpp.com/a/98826注意事项:参考代码:n,w = map(int,input().split()) gi = []    # 重量……

小白都能看懂的解答

摘要:解题思路:其实后面间距是一样的200000,最后一个是400000,写的时候可以改一下,当时懒不愿改了注意事项:参考代码:#include<stdio.h>int main(){ int x,y; s……