随笔分类 -  C++

摘要:#include <bits/stdc++.h> using namespace std; int number=0; class bank{ private: string name; int card; double money; string p; vector<string> log; st 阅读全文
posted @ 2025-03-08 10:01 fushuxuan1 阅读(2) 评论(0) 推荐(0) 编辑
摘要:贪心算法基本要素 1.贪心选择性质:通过每个子问题的最优选择,可以得到整个问题的最优解。 意味着,当我们面对一个问题时,我们就可以通过贪心策略来做出局部最优 的选择,最终得到全局最优的解。 2.最优子结构:问题的最优解包含子问题的最优解。意味着,问题可以分解 成若干个子问题,每个子问题可以独立求解, 阅读全文
posted @ 2024-10-19 14:43 fushuxuan1 阅读(16) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int main(){ int n,x,s_x; cin>>n>>x; int a[n],b[n]; for(int i=0;i<n;i++){ a[i]=i+1; } int j=0,t,d=0; int 阅读全文
posted @ 2024-10-05 08:46 fushuxuan1 阅读(21) 评论(0) 推荐(0) 编辑
摘要:二叉树: #include <bits/stdc++.h> using namespace std; int main(){ int n,sum=0; cin>>n; for(int i=1;i<=n;i*=2){ sum++; } cout<<sum; } 冒泡排序: #include <bits 阅读全文
posted @ 2024-09-15 15:57 fushuxuan1 阅读(8) 评论(0) 推荐(0) 编辑
摘要://服务端(以C++作范例) #include"mysocket.h" //导入头文件:由于mysock头文件本身就有其它文件,这里无需导入 using namespace std; SOCKET s_accept; int main() { cout << " 服务端 \n"; cout << " 阅读全文
posted @ 2024-09-07 09:48 fushuxuan1 阅读(8) 评论(0) 推荐(0) 编辑
摘要:#include "myscoket.h" using namespace std; int main(int argc, char** argv) { cout<<" 客户端 \n"; startup(); SOCKET client=createSocket(PF_INET,SOCK_STREA 阅读全文
posted @ 2024-09-07 09:37 fushuxuan1 阅读(5) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int qz(int a){ if(a==4){ cout<<"4,5-->9,10"<<endl; cout<<"8,9-->4,5"<<endl; cout<<"2,3-->8,9"<<endl; cou 阅读全文
posted @ 2024-08-14 10:00 fushuxuan1 阅读(8) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int main(){ freopen("mz.txt","r",stdin); freopen("out.txt","w",stdout); string n; int a=0,m[7],j; cin>>n 阅读全文
posted @ 2024-07-29 15:01 fushuxuan1 阅读(2) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int main(){ int a,b,t; cin>>a; char n; b=2*(a-1)+1; for(int i=1;i<=a;i++){ cout<<setw(b-i); t=64; for(in 阅读全文
posted @ 2024-07-22 15:43 fushuxuan1 阅读(4) 评论(0) 推荐(0) 编辑
摘要:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System. 阅读全文
posted @ 2024-07-12 15:55 fushuxuan1 阅读(20) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int jc(int a){ if(a<=2){ return a; } return jc(a-1)*a;; } int jch(int n){ int sum=0; if(n<=1){ return n; 阅读全文
posted @ 2024-07-10 15:57 fushuxuan1 阅读(4) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int main(){ int n,sum=0; cin>>n; vector<int> b; b.push_back(1); for(int i=2;i<=n;i++){ for(int j=0;j<b.s 阅读全文
posted @ 2024-07-10 15:39 fushuxuan1 阅读(9) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> #include <string> #include "minecraft.h" using namespace std; TxMinecraft mc; int main(int argc, char** argv) { bool con=mc.Connec 阅读全文
posted @ 2024-06-15 10:01 fushuxuan1 阅读(6) 评论(0) 推荐(0) 编辑
摘要://客户端 #include"mysocket.h" //头文件 using namespace std; int main() { cout << " 客户端 \n"; startup(); //启动 //检测版本号 if (LOBYTE(wsdata.wVersion) != 2 || HIBY 阅读全文
posted @ 2024-06-08 10:02 fushuxuan1 阅读(19) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; vector<int> z(vector<int> x,vector<int> y){ vector<int> s(x.size(),0); int sum=0; for(int i=0;i<x.size() 阅读全文
posted @ 2024-06-07 19:47 fushuxuan1 阅读(3) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; vector<int> z(vector<int> x,int y){ vector<int> s; int sum=0; for(int i=0;i<x.size()||sum;i++){ if(i>=x. 阅读全文
posted @ 2024-06-01 14:32 fushuxuan1 阅读(5) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; vector<int> z(vector<int> x,vector<int> y){ int sum=0; vector<int> s(x.size()+y.size()+10,0); for(int i= 阅读全文
posted @ 2024-05-31 19:56 fushuxuan1 阅读(4) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; vector<int> z(vector<int> v,vector<int> n){ int m; m=max(v.size(),n.size()); vector<int> s(m+2,0); int s 阅读全文
posted @ 2024-05-25 14:55 fushuxuan1 阅读(5) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; void z(vector<int> v,int c){ vector<int> s; int sum=0; for(int k=0;k<v.size()||sum!=0;k++){ sum+=v[k]*c; 阅读全文
posted @ 2024-05-25 09:58 fushuxuan1 阅读(6) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> #include <windows.h> #include <conio.h>//控制台输入输出头文件 using namespace std; int main(){ HANDLE handle=GetStdHandle(STD_OUTPUT_HA 阅读全文
posted @ 2024-05-24 20:29 fushuxuan1 阅读(2) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示