题解列表
python编写题解 2792: 三角形判断
摘要:解题思路:三角形的三边关系:任意两边之和大于第三边或者任意两边之差小于第三边。参考代码:a, b, c = map(int, input().split())
if a+b > c and a+c ……
python编写题解 1039: [编程入门]宏定义之闰年判断
摘要:解题思路:普通年能被4整除且不能被100整除的为闰年,世纪年能被400整除的是闰年参考代码:def LEAP_YEAR(year):
if year % 4 == 0 and year % ……
最长不下降子序列的长度(动态dp——寻找前一项的最优解)
摘要:解题思路:利用动态规划,确定出到每一个数字的时候,所对应的dp[i]为多少dp[i]表示为在第i个数字时,前i个数字能组成的最长不下降子序列的长度例如给出一个数列: 1 3 5 2 8 7dp[4]=……
python编写题解 2793: 点和正方形的关系
摘要:解题思路:求x,y的区间注意事项:判断一个给定的点是否在这个正方形内参考代码:x, y = map(int, input().split())
if x >= -1 and x <= 1 and y……
DFS(深度优先遍历)
摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>
#include<vector>
using namespace std;
int flag=0;
class……
利用类型转换解Hello, world!
摘要:解题思路:利用char,把int类型转换为char类型即可注意事项:参考代码:#include<iostream>using namespace std;int main(){int a = 0;wh……
python编写题解 1028: [编程入门]自定义函数求一元二次方程
摘要:解题思路:参考代码:from math import sqrt
a, b, c = map(int, input().split())
d = b**2-4*a*c
e = sqrt(4*a*c……
python编写题解 1480: 模拟计算器
摘要:注意事项: 商是整除while True:
try:
a, b, c = map(str, input().split())
a, b = int(a),……