![](https://img-blog.csdnimg.cn/20190918140158853.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
C++编程练习
联系
qq_29230349
这个作者很懒,什么都没留下…
展开
-
合并列表leetcode
#include #include #include #include<unordered_map>#include#includeusing namespace std;ListNode* mergeTwoLists(ListNode* l1, ListNode* l2){ListNode* head=nullptr;ListNode* res=nullptr; while(l1 &&l2){ if(l1->val<l2->va)原创 2021-11-28 12:53:47 · 155 阅读 · 0 评论 -
20 leetcode
#include #include #include #include<unordered_map>#include#includeusing namespace std;unordered_map store={{’]’,’[’},{’)’,’(’},{’}’,’{’},};bool isvalid (string &vector){std::stack<char> res;for(int i = 0;i<vector.size();i++原创 2021-11-28 11:29:08 · 238 阅读 · 0 评论 -
在线编辑器
https://rextester.com/l/cpp_online_compiler_gcc原创 2021-11-24 12:31:26 · 555 阅读 · 0 评论 -
一次读入两行字符串
//we have defined the necessary header files here for this problem.//If additional header files are needed in your program, please import here.#include<iostream>#include<string>string...原创 2020-02-22 20:09:07 · 677 阅读 · 0 评论 -
与的作用,左移右移
这回你的任务很简单,就是简单的数数,不过是在二进制下计算哦,计算一个十进制数的二进制包含多少个1.如3的二进制是11,则包含2个1,2的二进制是10,则包含1个1#include<iostream>int count(int n){ int count=0; int result; int i=0; while(i<32){ ...原创 2020-02-22 20:11:29 · 448 阅读 · 0 评论 -
37. Matrix 动态规划
现在你面对一个n×m的矩阵,矩阵中的每一个元素都是一个整数,现在你需要计算从矩阵的左上角走到右下角所走过的所有元素相加的最大和。注意:只能向右或者向下走,不能走出边界#include <iostream>#include <algorithm> //动态规划,每次走最小值即可using namespace std; int value[1024][1024];...原创 2020-02-22 20:11:59 · 697 阅读 · 0 评论 -
20.R的n次幂scanf memset
输入The input will consist of a set of pairs of values for R and n. The R value will occupy columns 1 through 6, and the n value will be in columns 8 and 9.输出The output will consist of one line for e...原创 2020-02-22 20:12:18 · 153 阅读 · 0 评论 -
struct类型的vector和sort使用
//http://www.voidcn.com/article/p-xnzwqsgc-bag.html#include<iostream>#include<string>#include<string.h>#include<vector>#include<algorithm> //sortstruct a{ //定义一个结...原创 2020-02-22 20:14:48 · 811 阅读 · 0 评论