自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Twoutopians

世界樹。『我們無處不在Wir Sind Uberal.』

  • 博客(26)
  • 收藏
  • 关注

原创 [Day 2] 7.4.1 八皇后问题 (全排列+数学解法)

刘X佳:1、子集枚举模型从64个格子中获得一个含8个格子的子集,使得该子集中任意一个格子都不在同一行/同一列/同一对角线上子集共有2^64个,太多了2、组合生成模型枚举量转化为C8-64,仍然很多3、全排列模型优先满足每行每列不重复,排除不符对角线的情况可以表示成每一行为一位,对应的列的编号是该位上的元素。故为1~8的全排列。枚举量为A8-8,40320种,很小

2018-01-11 19:34:45 959

原创 [Day 1] 7.3.3 子集生成-二进制法

按位与 & 交集按位或 | 并集按位异或 ^ 对称差-----------------------------------#include #include using namespace std;int n,p[20];void print_sub(int s){ for(int i=1;i  if(s&(1 cout return ;}

2018-01-11 18:46:37 201

原创 [Day 1] 7.3.2 子集生成-位向量法

假设非可重集。-----------------------------------#include #include using namespace std;int n,p[20];bool b[20];void sub(int cur){ if(cur==n+1){//递归边界   for(int i=1;i  if(b[i]) cout  cout

2018-01-11 15:12:25 159

原创 [Day 1] 7.3.1 子集生成-增量构造法

升天Time.--------------------------------#include #include #include using namespace std;int k,n; int s[20],p[20];bool used[20];void sub(int num){//num为元素个数 if(!num){//递归边界   for(in

2018-01-11 14:25:35 339

原创 [Day 1] 7.2.2 生成可重集的排列(包括利用STL)

升天Time.-------------------------------- #include  #include  #include  #include  using namespace std;  int n; int a[20],p[20],used[20],num[20]; void perm(int d){  if(!d) {  for(i

2018-01-11 14:21:21 191

原创 [Day Zero] 7.2.1 生成1~n的排列

There for you.------------------------------递归构造全排列,很经典的问题,从后n位的全排列-》后n-1位的全排列,一边构造,一边判重,符合就储存,注意,此处边判断边输出不好。#include #include #include using namespace std;int n;bool used[20];int a

2018-01-09 19:43:35 196

原创 [Day Zero] 7.1-3 分数拆分 (Fractions Again?!,UVa 10976)

There for you.-----------------------------y>k枚举到y=min(x,2k)=2k为止。#include #include using namespace std;int k;//解决无限枚举 //枚举范围和剪枝同样重要 int main(){ while(cin>>k) for(int y=k+1;y

2018-01-09 19:11:01 152

原创 [Day Zero] 7.1-2 最大乘法(Maximum Product,UVa 11059)

There for you.-----------------------------若枚举每个起点和终点,则复杂度为n!,枚举量达到18!是负数阻碍了连续相乘,最大乘积只可能在负数前后或末尾产生,因此只需要在负数处计算乘积。记忆每个负数之前的序列的乘积和,并在遇到每一个负数的时候判断一下是第奇数个还是第偶数个,若是第奇数个则不乘上它本身,偶数个则乘上它本身,判断一下末尾的总乘积和最后

2018-01-09 18:31:42 233

原创 7-1 除法(Division,UVa 725)

#include #include #include using namespace std;int a[10],n,beichu;bool used[15],used1[15],have;bool judge(int num){ int t=0; for(int i=0;i used1[i]=used[i]; while(num){  if(!used

2018-01-08 14:05:56 247

原创 2-5 数据统计

//2-5 数据统计 key:输入结束 重定向#include #include using namespace std;int n,s,minn,maxn,x=1;int main(){freopen("2-5.in","r",stdin);freopen("2-5.out","w",stdout);scanf("%d",&n);maxn=n;minn=n;

2017-10-16 10:22:22 303

原创 2-4 Factorial

//2-4 Factorial key:逐步取模 计时函数 #include #include #include using namespace std;int n,s;const int MOD=1000000;int main(){//常数用大写变量名 scanf("%d",&n);for(int i=1;iint factorial=1;//!!此处f

2017-10-16 09:05:12 343

原创 Also sprach ich

All the depression and illusions they can't stop you.

2017-06-23 18:54:45 270

原创 好好好说得太好了

2017-06-14 14:38:21 377

原创 【Floyd】[CODEVS] p2602 最短路径问题

今天这题算是写不了了#include #include #include #include using namespace std;int INF=0x3f3f3f3f;int n,m,s,t;float d[102];int v[102][102];struct point{int x,y;};point p[105];int ma

2017-06-13 19:47:00 255

原创 朝も 来ないまま

早安。

2017-06-10 02:40:56 322

原创 【Floyd传递闭包】[CODEVS]p1009 产生数

#include #include #include #include using namespace std;int num=1,n,k,x,y,len,sum;int p[15],d[105][105],t[10005];const long long INF=0x3f3f3f3f;string s;int search(int m){for(int j

2017-06-09 19:54:36 192

原创 Ai kotoba

教室里装了监控是不是意味着可以天天见到你了

2017-05-09 18:51:47 256

原创 puzzle

#include #include using namespace std;int m,n,nx,ny;char d[20][20];int b[20][20];int run[4][2]={{1,0},{-1,0},{0,1},{0,-1}};void dfs(int x,int y){ cout if(d[x][y]=='.'||d[x][y]=='

2017-04-04 19:54:50 306

原创 HAMMING

#include #include using namespace std;int N,B,D;int ham(int x,int y){int num;int t=x^y;coutwhile(t>0){num+=t&1;t=(t>>1);}return num;}int main(){cin>>N>>B>>D;for(int i=0

2017-03-31 19:52:52 222

原创 少林神棍(未完)

#include #include using namespacestd;int num=1;bool dfs(int snum;int len){if(snum==0) return 1;for(int i=1;iif(len-stick[i]==0) dfs(snum-1,len);else dfs(snum-1,len-stick[i]);}}

2017-03-28 19:53:30 385

原创 El Amor En Los Tiempos Del Colera

感觉今天的雾霾很严重,喉咙疼了一早上。把卡掉了,没有钱补。刚刚考完,OI更加轻松。总之是,诸多事情想说给你听。

2017-03-17 18:12:28 1451

原创 小球下落

#include #include using namespace std;int dp,N,n,h[1024],I,dh[100]={1};void br(int i){//建树函数 if(dp==N) return;h[i]=1;h[2*i]=1;h[2*i+1]=1;dp++;br(2*i);br(2*i+1);}void ball(int cur

2017-02-24 12:49:52 293

原创 ZZY的八皇后

#include #includeusing namespace std;int a[80],b[80],ans,c[80],i,n,j; void f(int i,int n){if(i>n){ans++;return;}for(int j=1;jif(!a[j]&&!b[i+j]&&!c[i-j+8]){a[j]=true;b[i+j]=true;c

2017-01-25 13:26:31 259

原创 一个很有意思的写法

#include#include#include#includetypedef long long ll;using namespace std;ll s[1000100];int main(){int a,n;while(scanf("%d %d",&a,&n)){priority_queue,greater > q;int pos=0; q.pu

2017-01-24 22:10:16 357

原创 【Broken Necklace】USACO第一次AC

题目很简单,代码也挺丑的,为了偷懒没有把两个循环写在一起。过两天优化一下。不过还是很开心。/*ID:twoutop1LANG: C++TASK: beads*/#include #include #include #include using namespace std;string b;int sum1[1000],sum2[1000],m,sums,maxn

2017-01-24 18:25:05 219

原创 A Brand New Begining

这个假期很短暂,虽然如此每天写代码的时间都很快乐,进度太慢了,这么想着不由得责备拖沓懒惰的自己。在新年的暖气中昏昏欲睡,陶醉于GTA5的Ubantu桌面和笔电镀光的银色外壳。啊,新年真是太好了。虽然感觉独自一人的学校总有点小小的寂寞,但我想这很快就会被AC的喜悦取代的。不太想见到同学,甚至连待在机房都会紧张。过年也不想回家。害怕见到别人。只有一个人躲在耳机背后,听见十年

2017-01-24 18:09:26 342

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除