题解列表

筛选

The 3n + 1 problem

摘要:解题思路:利用for循环逐个遍历输入数之间的数,计算每一个数的周期,找到最大周期即可注意事项:本题有一个坑,输入的第一个数不一定是大于第二个数的,所以需要找到输入两数中的较大值与较小值参考代码:#in……

编写题解 1366: 超级书架2

摘要:解题思路:注意事项:参考代码:n,b=map(int,input().split())#奶牛数量与书架高度h_list=[]#存放奶牛身高h=0#初始高度t=0#用了多少头奶牛for i in ran……

简洁版代码

摘要:解题思路:注意事项:参考代码:#include<iostream> using namespace std; string s; struct BiTreeNode{ char val; ……

利用数组求解Minesweeper

摘要:解题思路:此题可用两个二维数组解决,一个char类型,一个int类型char用于接收用户输入的  .和*;在接收时即可给第二个int类型数组赋值,当char中接收的是.时,在int中的对应位置输入0,……

数学方法求解蛇行矩阵

摘要:解题思路:本题通过观察可知1 3 6 10 152 5 9 144 8 137 1211a[0][0]+2=a[0][1];  a[0][1]+3=a[0][2];  a[0][2]+4=a[0][3……

1097: 蛇行矩阵

摘要:解题思路:注意事项:参考代码:#include <iostream>using namespace std;int main(){   int x, cnt=1, mat[100][100];   f……

错误示范-临时变量

摘要:#include<stdio.h>int main(){    int n;    long long int Sn=0;    scanf("%d",&n);        for(int i=1,……

天才的写法

摘要:解题思路:注意事项:参考代码:while True:    try:        array = list(map(int, input().split()))        array_odd =……