- 博客(16)
- 资源 (4)
- 收藏
- 关注
原创 水,,
#include// hpuoj_judge#includetypedef long long ll;int x,m;ll mul(ll a,ll b){ return ((a%m)*(b%m))%m;}ll cal(ll n,ll origin){ ll ans=1; while(n) { if(n&1) ans=mul
2016-11-27 21:12:15 339
原创 二分
#include //hdu1969using namespace std;const int N=10000+10;const double pi=acos(-1);const double precision=1e-6;int n,f,a[N];double s[N];bool ok(double si){ int num=0; for(int i=0;i<n;
2016-11-27 15:42:21 212
原创 递归回溯
#include //nyoj_488using namespace std;const int N=30;int a[N],n,flag=1;int vis[N],isp[N];void init(){ memset(isp,0,sizeof(isp)); for(int i=2;i<N;i++) { if(!isp[i])for(int j=
2016-11-27 14:42:19 265
原创 遍历二叉树
#include //uva122using namespace std;const int N=110;const int Maxn=1000000;struct Node{ bool have_value; int v; Node *left,*right; Node():have_value(false),left(NULL),right(NULL)
2016-11-27 14:04:44 178
原创 队列
#include//uva540using namespace std;const int maxt=1000+10;int main(){ int t,kase=0; while(scanf("%d",&t)==1&&t) { printf("Scenario #%d\n",++kase); map team; fo
2016-11-27 14:01:39 239
原创 水了,,
KI的斐波那契DescriptionKI十分喜欢美丽而优雅的斐波那契数列,最近他新认识了一种斐波那契字符串,定义如下f (0) = b, f (1) = a,f (2) = f (1) + f (0) = ab,f (3) = f (2) + f (1) = aba,f (4) = f (3) + f (2) = abaab,......KI想知道 f (n
2016-11-20 21:41:43 438
原创 水了,,
#include//找能判断的情况,猜出差值规律#include#include#includeusing namespace std;typedef long long ll;const int N=10000;int a[N],b[N];int main(){ int t; scanf("%d",&t); while(t--) {
2016-11-20 21:38:56 269
原创 水了,,递推 hdu 2563
/*推错,,自行理解答案;题目要求是每步走后,上一步的位置便塌陷,所以,这一步是向上走来的那有三个方向可走,而如果是向左或向右走来的,那就只有两个方向可走,设f(n)为走n步后存在的可能走法,不管上一步是怎么走来的,f(n)>2*a[n-1];想等于的话,那就找n-1步是由向上走来的走法数目,其实就是f[n-2];因为n-1步由向上走法来的数目有f[n-2];f[n]=f[n-1]+f[n
2016-11-20 10:13:34 246
原创 水了,,递推 hdu 2502
/*推出来了,,额,*/#include #include #include #include using namespace std;const int N=21;int a[N],b[N],ans[N];void init(){ int s=4; a[1]=1,a[2]=3;a[3]=8; ans[3]=12; for(int i=4;i<N
2016-11-20 09:48:04 242
原创 Pocket Cube hdu 5983
/*数字是6个,直接模拟,采取的是按题目的展开面位置来判断是否合法,枚举三种转法,变换数组的值,每两个面造的空间对应一种,没有用滚动数组,强行覆盖*_*!*/#include#include#includeusing namespace std;int a[10][10],b[10][10];int xx(){ set pq; for(int i=0;i<=7;
2016-11-20 09:42:29 713
原创 分治
#include //nyist 90int solve(int n,int m){ if(n==1||m==1) return 1; else if(n==m) return solve(n,m-1)+1; else if(n>m) return solve(n-m,m)+solve(n,m-1); else return solve(n,n);}int main(){
2016-11-13 23:46:26 234
原创 二分图的最大匹配
//dfs版本 hdu 1207 /*增广路径就交替路,非匹配边加匹配边,奇数次,能使匹配点加1,同时取反即改变匹配对象*/#include#include#include#include#include#includeusing namespace std;const int N=105;int n,m;int a[N][N];int vis[N];int cors
2016-11-13 19:35:02 239
原创 哈弗曼编码
//老师很细致的讲了这个编码,,直接摘自课本的代码,很不赖,,#include#include#include#include#include#includeusing namespace std;const int N=30;typedef struct{ int weight; int parent,lchild,rchild;}HTNode,*HuffmanTree;
2016-11-13 18:12:57 569
原创 最大流
//最大流 hdu 3549/*模板-不断找到从源点到汇点的路线,找到一次,就更新一次存边用的二维数组的值,并且对应有个流值,取和即为最大流(反向边不懂...)*/#include#include#include#include#includeusing namespace std;typedef long long ll;const int N=1105;int a[N]
2016-11-13 17:25:39 243
原创 大数运算
//大数加法 hdu 1002(可练习hdu 1715,1753,2100)#include #include#includeusing namespace std;const int N=1500;int a[N],b[N];char a1[N],b1[N];int main(){ int t,cas=1; cin>>t; while(t--){
2016-11-13 15:47:33 308
原创 参考答案...
编号统计#include#include#includeusing namespace std;int a[300000];int n,i,k,max1,u,t;int main(){scanf("%d",&t);while(t--){scanf("%d",&n);for(i=0;iscanf("%d",&a[i]);a[n]=-1;sort(a
2016-11-05 21:29:23 741
《具体数学计算机科学基础》 第二版
2018-06-28
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人