摘要: <div class="cnblogs_Highlighter"><pre class="brush:csharp;gutter:true;"> #include<iostream>#include<cstdio>#include<cstring>using namespace std; //思路: 阅读全文
posted @ 2022-03-24 21:00 ghgfdsf 阅读(31) 评论(0) 推荐(0) 编辑
摘要: #include<iostream>#include<cstdio>#include<cstring>using namespace std; //思路:用了两个while循环,分别判断出回文和ABABBABA,并输出 用三个for循环嵌套,来判断是否符合条件 bool bbb(int i) //判 阅读全文
posted @ 2022-03-24 20:57 ghgfdsf 阅读(35) 评论(0) 推荐(0) 编辑
摘要: #include<bits/stdc++.h>using namespace std;typedef pair<double,double> pdd;set<pdd> m;//存斜率k和截距bconst int N=30;pdd point[N*N];#define x first#define y 阅读全文
posted @ 2022-03-23 22:44 ghgfdsf 阅读(36) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<algorithm> #include<cmath> #include<cstdio> #include<cstring> using namespace std; int sum=0; void dfs(int pos, int cnt){ 阅读全文
posted @ 2022-03-15 19:06 ghgfdsf 阅读(25) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> 2 int main() 3 { 4 int i,j,t,a[310],count,x,m,k,n; 5 scanf("%d",&x); 6 while(x--) 7 {k=0; 8 scanf("%d %d",&m,&n); 9 for(i=0;i<n;i++) 阅读全文
posted @ 2022-03-14 18:51 ghgfdsf 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 给定一个载重量为M的背包,考虑n个物品,其中第i个物品的重量 ,价值wi (1≤i≤n),要求把物品装满背包,且使背包内的物品价值最大。有两类背包问题(根据物品是否可以分割),如果物品不可以分割,称为0—1背包问题(动态规划);如果物品可以分割,则称为背包问题(贪心算法)。 下面分享此题的完整代码: 阅读全文
posted @ 2022-03-14 17:30 ghgfdsf 阅读(32) 评论(0) 推荐(0) 编辑
摘要: 2017年第二题等差素数列 标题:等差素数列 2,3,5,7,11,13,....是素数序列。类似:7,37,67,97,127,157 这样完全由素数组成的等差数列,叫等差素数数列。上边的数列公差为30,长度为6。 2004年,格林与华人陶哲轩合作证明了:存在任意长度的素数等差数列。这是数论领域一 阅读全文
posted @ 2022-03-04 19:58 ghgfdsf 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 解决方案: 1)把 scanf 换为 scanf_s 2)在前面加上 #pragma warning(disable:4996) 阅读全文
posted @ 2022-03-02 17:40 ghgfdsf 阅读(428) 评论(0) 推荐(0) 编辑