信息学奥赛一本通T1331-后缀表达式的值-Python 摘要:解题思路:定义一个Stack和对应的push和pop方法,然后将数字全部push进栈,然后根据操作符来eval计算,最后将结果pop出来。注意事项:参考代码:class Stack: def…… 题解列表 2024年03月05日 0 点赞 0 评论 646 浏览 评分:9.9
编写题解 2966: 最大质因子序列 摘要:解题思路:先找因数,在判断是不是质数。注意事项:参考代码:#include <stdio.h>#include <math.h>int yinshu(int c){ for (int i = 1; i…… 题解列表 2024年03月05日 0 点赞 0 评论 603 浏览 评分:9.9
记忆化搜索解法 ```importjava.util.Arrays;importjava.util.Scanner;publicclassMain{staticintN;staticint[]a;staticint[]mem;staticintf(intx){if(mem[x]!=0)returnmem[x];int 题解列表 2024年03月05日 0 点赞 0 评论 592 浏览 评分:9.9
计负均正 使用C++语言编写 代码可能不是最简洁的 但是通俗易懂 容易理解 适合入门的 欢迎大家一起讨论 摘要:解题思路:注意事项:参考代码:#include <iostream>#include <iomanip>using namespace std;int main() { const int n …… 题解列表 2024年03月05日 0 点赞 0 评论 607 浏览 评分:0.0
编写题解 2002: 计算数字个数(Python) 摘要:解题思路:题解一:通过遍历字符串判断字符是否为数字参考代码:n=input() s1=0 for i in n: if i.isdigit(): s1+=1 prin…… 题解列表 2024年03月05日 0 点赞 0 评论 608 浏览 评分:0.0
蓝桥杯2023年第十四届省赛真题-冶炼金属 摘要:#include<iostream> using namespace std; const int MAX_N = 1e4 + 1; // 规定数据范围不超 int N, A[MAX_N], B…… 题解列表 2024年03月05日 0 点赞 0 评论 862 浏览 评分:9.9
平方差python解 解题思路:只有当x为奇数或4的倍数时才能拆分为两个数的平方差。注意事项:x-(x//2)求奇数的个数x//4求4的倍数的个数为了计算范围[L,R]内满足条件的数目,减去f(L-1)的目的是排除掉范围[1,L-1]中的数。这是因为题目中要求的是在[L,R]范围内的数目,而不是包括[1,L-1]的数目。 题解列表 2024年03月05日 0 点赞 1 评论 797 浏览 评分:6.0
java两种方式题解 动态规划、深度搜索(题目测试数据有坑,输入数据中有大于n的数据,会导致数组越界) importjava.util.*;publicclassMain{//1567publicstaticvoidmain(String[]args){//到达位置为x的地方有多少种方法Scannerscanner=newScanner(System.in);//普通动态规划解法intn=scanner 题解列表 2024年03月05日 0 点赞 0 评论 457 浏览 评分:9.9
台球碰撞问题 摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;#include<math.h>//调用数学库函数//使用三角函数注意事项://1、包含头文件…… 题解列表 2024年03月05日 0 点赞 0 评论 577 浏览 评分:0.0
图的遍历-BFS广度优先搜索(C++) 摘要:解题思路:#include<iostream> using namespace std; #define MAX_VERTEX_NUM 50 // 定义最大结点数; #define MAXQSI…… 题解列表 2024年03月05日 0 点赞 0 评论 697 浏览 评分:0.0