AIGC
AIGC
全部文章
题解
归档
标签
去牛客网
登录
/
注册
AIGC的博客
全部文章
/ 题解
(共25篇)
题解 | #链表中的节点每k个一组翻转#
/** * struct ListNode { * int val; * struct ListNode *next; * }; */ class Solution { public: /** * * @param head ListNode类 ...
C++
2022-04-12
0
275
题解 | #求最小公倍数#
#include <bits/stdc++.h> using namespace std; //辗转相除法求公约数 int yueshu(int a, int b){ if(a < b) swap(a, b); int num = b; while(a%b ...
C++
2022-03-31
3
363
题解 | #字符统计#
#include<bits/stdc++.h> using namespace std; //排序逻辑 bool compare(pair<char, int> a, pair<char, int> b){ if(a.second != b.second)...
C++
2022-03-31
0
252
题解 | #整型数组合并#
使用STL set,set会自动去重和排序。 #include <bits/stdc++.h> using namespace std; int main(){ int n; while(cin >> n){ set<int> s...
C++
2022-03-29
0
227
题解 | #计算日期到天数转换#
#include <bits/stdc++.h> using namespace std; bool isrich(int x){ if(((x %4 == 0) && (x % 100 != 0)) || x % 400 == 0){ retu...
C++
2022-03-27
0
286
题解 | #截取字符串#
简洁代码 #include <bits/stdc++.h> using namespace std; int main(){ string s; int k; cin >> s >> k; cout << s.subs...
C++
2022-03-24
1
251
题解 | #输出单向链表中倒数第k个结点#
using namespace std; struct ListNode { int m_nKey; ListNode* m_pNext; ListNode(): m_nKey(0), m_pNext(nullptr){}; ListNode(int x): m_n...
C++
2022-03-24
0
273
题解 | #蛇形矩阵#
using namespace std; int main(){ int n; cin >> n; for(int i = 1; i < n + 1; i++){ for(int j = i; j < n + 1; j++){ ...
C++
2022-03-24
0
278
题解 | #删除字符串中出现次数最少的字符#
using namespace std; int main(){ string s; while(cin >>s){ map<char, int> map; for(int i = 0; i < s.size(); i++){ ...
C++
2022-03-23
0
281
题解 | #提取不重复的整数#
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; set<int> set; //从后往前,使用set去重,插入失败时不打印。 ...
C++
2022-03-23
0
237
首页
上一页
1
2
3
下一页
末页