会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
wangys
博客园
首页
新随笔
联系
订阅
管理
2025年7月29日
c++ 进制转换代码
摘要: //二转十#include<iostream> using namespace std; int main() { string n; cin>>n; int sum=0,p=1; for(int i=n.size()-1;i>=0;i--){ if(n[i]=='1'){ sum+=p; } p*
阅读全文
posted @ 2025-07-29 14:30 王ys
阅读(10)
评论(0)
推荐(0)
2025年7月26日
vector-sort函数排序
摘要: #include<bits/stdc++.h> using namespace std; int main(){ vector<int> n={3,1,4,1,5,9,2,6}; sort(n.begin(),n.end()); cout<<"升序: "; for(int i:n){ cout<<i
阅读全文
posted @ 2025-07-26 14:58 王ys
阅读(9)
评论(0)
推荐(0)
2025年7月19日
c++ &easyx 星空画面
摘要: // 编译环境:Visual C++ 6.0~2022,EasyX_2023大暑版 // https://easyx.cn // #include <graphics.h> #include <time.h> #include <conio.h> #define MAXSTAR 200 // 星星总
阅读全文
posted @ 2025-07-19 15:46 王ys
阅读(5)
评论(0)
推荐(0)
2025年7月17日
后缀表达式运算
摘要: //"6 9 + 5 3 * - 8 -" #include <bits/stdc++.h> using namespace std; int n,i = 0,a[100]; char a1; int main(){ cin>>n; while(n--){ cin>>a1; if(a1>='1' &
阅读全文
posted @ 2025-07-17 15:48 王ys
阅读(5)
评论(0)
推荐(0)
2025年7月5日
c++ &easyx 五子棋
摘要: #include <graphics.h> // 引用图形库头文件 #include <conio.h> void set_black(int x,int y){ setfillcolor(BLACK); fillcircle(x,y,12); } void set_white(int x,int
阅读全文
posted @ 2025-07-05 16:00 王ys
阅读(11)
评论(0)
推荐(0)
2024年11月16日
二分查找 理论 例题
摘要: 递归代码 int binary_search(int arr[],int left,int right,int key){ if (left>right){//区间无效 return -1; } int mid=left+(right-left)/2; //直接平均可能会溢出 if(arr[mid]
阅读全文
posted @ 2024-11-16 09:59 王ys
阅读(15)
评论(0)
推荐(0)
2024年11月1日
类与对象 理论 代码
摘要:
阅读全文
posted @ 2024-11-01 19:02 王ys
阅读(13)
评论(0)
推荐(0)
2024年10月19日
1828:【02NOIP提高组】均分纸牌
摘要: 1828:【02NOIP提高组】均分纸牌 时间限制: 1000 ms 内存限制: 65536 KB提交数:2726 通过数: 2102 【题目描述】 有N堆纸牌,编号分别是1,2,3,...N。每堆上有若干张,但纸牌总数必为N的倍数。可以在任一堆上取若干张纸牌,然后移动。移牌规则为:在编号为1的堆上
阅读全文
posted @ 2024-10-19 15:27 王ys
阅读(70)
评论(0)
推荐(0)
贪心算法理论
摘要: 贪心算法基本要素 1.贪心选择性质:通过每个子问题的最优选择,可以得到整个问题的最优解。 意味着,当我们面对一个问题时,我们就可以通过贪心策略来做出局部最优 的选择,最终得到全局最优的解。 2.最优子结构:问题的最优解包含子问题的最优解。意味着,问题可以分解 成若干个子问题,每个子问题可以独立求解,
阅读全文
posted @ 2024-10-19 14:39 王ys
阅读(32)
评论(0)
推荐(0)
2024年9月16日
组合排列
摘要:
阅读全文
posted @ 2024-09-16 09:43 王ys
阅读(19)
评论(0)
推荐(0)
下一页
公告