- 博客(8)
- 收藏
- 关注
转载 acwing A+B
#include <iostream>#include <vector>using namespace std;vector<int> C ;vector<int> add(vector<int> &A, vector<int> &B) // 加上 “&” 可以避免把整个数组...
2019-07-27 11:29:16 222
转载 奇怪的电视 C++ BFS
#include <cstdio>#include <cstdlib>#include <queue>using namespace std;int G[25][25],vis[2 << 22],n,init;queue<int> q;#ifndef ONLINE_JUDGEvoid print_by_2(int va...
2019-06-03 22:13:55 700
转载 猴群 c++ bfs
#include<bits/stdc++.h>using namespace std;int m,n,ans,front,rear;int dx[5]={0,1,-1,0,0},dy[5]={0,0,0,1,-1};int q[3][10010];//二元组储存节点信息 int a[110][110];void bfs(int i,int j){ front=1;rea...
2019-06-02 20:40:26 1394
原创 奇怪的电梯 c++ 映射想法
#include <bits/stdc++.h>using namespace std;int n , a , b , f , r , k[105] ,ll[105] , u[105] ;int q ;bool has[2][105] , hi [105]; // 1 向上 2 向下void prhas(){for(int i = 1 ; i <= b ; ...
2019-05-31 17:36:40 451
原创 过生日 dfs
#include <bits/stdc++.h>#include <stdio.h>#include <string.h>const int maxnode=2000000,hsize=500007;struct{ int v,next;} node[maxnode];int w1[30],w2[30],hash[hsize],totn,lim,c...
2019-05-19 22:28:04 143
转载 四色原理c++实现
验证四色原理描述验证任何一个平面存在一种着色方案,使得相连的区域颜色不同,且颜色种类不大于4;输入第一行输入n。第2n+1行:每行表示1n个省,相邻的省用1表示(本身不与本身相邻)。输出输出每种可以填色的方式输入样例 170 1 0 0 0 0 11 0 1 1 1 1 10 1 0 1 0 0 00 1 1 0 1 0 00 1 0 1 0 1 00 1 0 0 1...
2019-04-03 20:15:40 2569
原创 C++寻找 从2到n的孪生素数
题目:数学中有很多奇特的现象,孪生质数就是一种(孪生素数就是指相差2的质数对,例如3和5,5和7,11和13…),现在要求输出所有在m和n范围内的孪生质数。输入一行一个整数 n (1 <=n <=2^31)输出若干行 ,每行两个整数,之间一个空格隔开,从小到大输出每一对孪生素数样例输入100样例输出1003 55 711 1317 1929 3141 43...
2019-03-17 16:16:07 5797 1
原创 埃式筛法 与 欧式筛法 总结
用 欧式筛法 与 埃式筛法 寻找素数欧式 .#include&lt;bits/stdc++.h&gt; using namespace std;#define MAXN 10001000bool a[MAXN];int main(){ int n; cin&gt;&gt;n; memset(a,1,sizeof(a)); //a数组是bo...
2019-03-17 15:54:51 1416 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人