题解列表

筛选

2603,利用set容器的特性快速解决

摘要:解题思路:SET容器在插入时会自动排序,重复的内容只存储一个,容器中不允许插入重复的值。size   返回容器中个数insert  插入元素erase  删除元素clear  清空容器中的元素find……

李白打酒加强版动态规划

摘要:分析:这是一道动态规划题,设f[i][j][k]表示走到了第i个位置,遇到了j个花,还剩k斗酒的合法方案数. 初始化很简单就是f[0][0][2]=1,因为一开始酒的数量是2 假如共遇到店……

reverse函数解

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

1098: 陶陶摘苹果

摘要:```cpp #include using namespace std; int main() { int a[10],n,sum=0; for(int i=0;i>a[i……

1097: 蛇行矩阵

摘要:```cpp #include using namespace std; int main() { int x,cnt=1,mat[100][100]; for(int j……

1096: Minesweeper

摘要:```cpp #include #include using namespace std; const int maxn=101; int n,m,x[maxn],y[maxn],vist[……

1095: The 3n + 1 problem

摘要:```cpp #include using namespace std; int main() { int m,n,max; while(cin>>m>>n) {……

1093: 字符逆序

摘要:要注意,a数组是一个字符串数组,输入后最后一项是‘\0’,因此第8行的strlen(a)还要-1 ```cpp #include #include using namespace std; ……