题解列表

筛选

c++三行题解

摘要:解题思路:使用强转输出数据注意事项:while的循环读入参考代码:#include<bits/stdc++.h> using namespace std; int main(){     int……

表达式括号匹配(stack)

摘要:解题思路: 运用栈的性质 ```cpp #include using namespace std; int main() { string s; getline(cin, s);//……
优质题解

括弧匹配检验

摘要:解题思路: (1)初始创立一个空栈。 (2)逐个读入括号。 (3)如果是左括号,那么就压入栈中。 (4)如果是右括号,则先检查栈是否为空,如果栈为空,则表示无左括号与之匹配,匹配失败。如果栈不……

编写题解:分解质因数【Python】

摘要:解题思路:首先自定义函数判断是否为质数;分解质因数时:先找最小质因数flag,然后递归找n//flag的最小质因数参考代码:# 自定义函数来判断是否是质数 def isPrime(n):     ……

3074: 计算(calc)

摘要:参考代码: ```cpp #include using namespace std; stacknum;//存储数字 stackch;//存储字符 string str;//定义字符串 ……

2772:苹果与虫子

摘要:解题思路:注意事项:参考代码:#include <stdio.h>int main(){ int n,x,y;  scanf("%d%d%d",&n,&x,&y); if(y%x==0)   prin……