2020年4月14日
摘要:
#include<iostream> #include<queue> using namespace std; #define ElemType char typedef struct BiTNode{ ElemType data; struct BiTNode *lchild,*rchild; }
阅读全文
posted @ 2020-04-14 22:42
~明月几时有
阅读(216)
推荐(0)
2020年4月13日
摘要:
#include <stdio.h> union data{ int n; char ch; short m; }; int main(){ union data a; printf("%d, %d\n", sizeof(a), sizeof(union data) ); a.n = 0x40; p
阅读全文
posted @ 2020-04-13 19:19
~明月几时有
阅读(124)
推荐(0)
2020年4月12日
摘要:
#include<iostream> #include<algorithm> using namespace std; typedef long long LL; int n,k,cnt; LL w,g[50],sum[1<<24],ans; void dfs1(int cur,LL res){ i
阅读全文
posted @ 2020-04-12 16:49
~明月几时有
阅读(161)
推荐(0)
摘要:
#include<iostream> #include<iomanip> #include<cmath> using namespace std; const int N=20; int n; double spot[N][2],dis[N][N],state[1<<N][N],ans=1e9; b
阅读全文
posted @ 2020-04-12 10:37
~明月几时有
阅读(170)
推荐(0)
2020年4月1日
摘要:
while(r-l>=0.001){ m=(r+l)/2; if(fn(l)*fn(m)>0)l=m; else r=m; } printf("%.2lf ",l); //方程求根,给定单调区间[l,r] /* 1.l为根,m和r在l的右侧,fn(l)=0,fn(l)*fn(m)=0,else条件成
阅读全文
posted @ 2020-04-01 23:34
~明月几时有
阅读(841)
推荐(0)
2020年3月31日
摘要:
#include<iostream> using namespace std; /* (烽火传递) 烽火台是重要的军事防御设施,一般建在险要处或交通要道上。 在两座城市之间有n个烽火台,每个烽火台发出信号都有一定的代价。 为了使情报准确地传递,在连续的m个烽火台中至少要有一个发出信号。 现输入n、m
阅读全文
posted @ 2020-03-31 18:49
~明月几时有
阅读(140)
推荐(0)
摘要:
在一个月黑风高的夜晚,有一群人在河的左岸,想通过唯一的一根独木桥走到河的右岸。在这伸手不见五指的黑夜里,过桥时必须借助灯光来照明,很不幸的是,他们只有一盏灯。另外,独木桥上最多承受两个人同时经过,否则将会坍塌。每个人单独过桥都需要一定的时间,不同的人需要的时间可能不同。两个人一起过桥时,由于只有一盏
阅读全文
posted @ 2020-03-31 11:12
~明月几时有
阅读(221)
推荐(0)
2020年3月30日
摘要:
#include<iostream> #include<cstring> using namespace std; //连续邮资问题 /* 某国发行了n种不同面值的邮票 并规定每封信最多允许贴m张邮票 在这些约束下,为了能贴出{1,2,3,... ,maxvalue}连续整数集合的所有邮资,并使ma
阅读全文
posted @ 2020-03-30 23:19
~明月几时有
阅读(2919)
推荐(0)
2020年3月29日
摘要:
char *strcpy(char *s1,const char *s2){ char *p=s1; while(*p++=*s2++); return s1; } size_t strlen(const char *s){ size_t n=0; while(*s++)n++; return n;
阅读全文
posted @ 2020-03-29 21:19
~明月几时有
阅读(153)
推荐(0)
摘要:
#include<stdio.h> #include<time.h> #include<stdlib.h> int main(void){ int a[100],n,i; scanf("%d",&n); srand((unsigned)time(NULL)); //1. // int *p=a; /
阅读全文
posted @ 2020-03-29 21:14
~明月几时有
阅读(600)
推荐(0)