• 博客园logo
  • 会员
  • 周边
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
shalins
博客园    首页    新随笔    联系   管理    订阅  订阅
2024年11月14日
cout 格式化输出
摘要: setprecision(x) 当与fixed连用时,括号中的参数x表示小数点后的输出位数 默认情况下,setprecision(n) 设置浮点数的总精度,即数字的总位数(包括整数部分和小数部分)。 如果希望设置小数部分的精度,可以配合 fixed 或 scientific 使用。 即:cout < 阅读全文
posted @ 2024-11-14 19:28 shalins 阅读(72) 评论(0) 推荐(0)
2024年2月4日
使用map + list 模拟双链表,简化存取
摘要: 阅读全文
posted @ 2024-02-04 23:10 shalins 阅读(7) 评论(0) 推荐(0)
2024年1月29日
判断给出回文串能否构成新的回文串
摘要: AC代码如下: #include <bits/stdc++.h> using namespace std; bool judge(string s, int pos){ swap(s[pos], s[pos + 1]); swap(s[s.length() - pos - 1],s[s.length 阅读全文
posted @ 2024-01-29 16:23 shalins 阅读(11) 评论(0) 推荐(0)
2023年11月12日
字符串||01
摘要: 阅读全文
posted @ 2023-11-12 19:43 shalins 阅读(49) 评论(0) 推荐(0)
2023年10月31日
快速 || 归并 排序模板
摘要: #include <iostream> using namespace std; int n ; const int N = 1e6 + 5; int a[N]; void quick_sort(int a[], int l , int r ){ if(l >= r) return; int i = 阅读全文
posted @ 2023-10-31 15:43 shalins 阅读(7) 评论(0) 推荐(0)
2023年10月19日
二分法转化为判定问题
摘要: 题目: 地址:https://www.acwing.com/problem/content/104/ 这道题的二分性体现在平均值的最优性中 假设最大值为MAX,我们当前要判断的值为MID 当MID > MAX时,我们在当前条件下一定找不到符合假设的解,从而判断出比MID大的值全部无效。 当MID < 阅读全文
posted @ 2023-10-19 10:05 shalins 阅读(14) 评论(0) 推荐(0)
2023年10月16日
题记1|| 自然数的拆分
摘要: 题目: 代码 #include <iostream> using namespace std; int sta[105]; int n, top = 0; void dfs(int sum, int lst) { if (sum > n) { return ; } if (sum == n) { f 阅读全文
posted @ 2023-10-16 01:03 shalins 阅读(32) 评论(0) 推荐(0)
2023年10月14日
DFS
摘要: 题目:https://www.luogu.com.cn/problem/P1216 //还需理解 #include <iostream> #include <algorithm> #include <cstring> using namespace std; int r; int num[1005] 阅读全文
posted @ 2023-10-14 21:16 shalins 阅读(8) 评论(0) 推荐(0)
2023年10月12日
DP问题
摘要: 1.什么情况下可以使用动态规划来解决问题: (1)往往在求最优解的问题中使用动态规划。 (2)一个大问题可以被分解为小问题,且每一个子问题都对应一个互不相同的状态。 (3)在问题状态每次发生改变时,需要进行判断来决定如何改变。 阅读全文
posted @ 2023-10-12 01:05 shalins 阅读(45) 评论(0) 推荐(0)
2023年10月9日
斐波那契数列
摘要: 1.使用递归 时间复杂度为O(n) #include <iostream> int F[105];//储存之前的数据 int fib(int n) { if(n<=2) return F[n]=1; if( F[n] ) return F[n]; //使用记忆化搜索来降低实践复杂度 return F 阅读全文
posted @ 2023-10-09 00:37 shalins 阅读(21) 评论(0) 推荐(0)
下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3