木其网络科技专业程序员代写http://www.xmsydw.com
程序员学历擅长经验网店链接
apenny硕士ASP.NET PHP 电子 通信设计 图像 编程 网络5年进入店铺
zheng_qianqian本科C语言 C++面向对象 Java3年进入店铺
guoguanl本科Java Web项目 JSP Hibernate Struts Mysql4年进入店铺

随笔分类 -  简单题

摘要:题目大意:给你n棵树,可以用这n棵树围一个圈,然后在圈里面可以养牛,每个牛需要50平方米的空间,问最多可以养多少牛?其实就是求一个凸包,计算凸包面积,然后除以50,然后就得到答案,直接上模板了。凸包这一类型的题目差不多,可以作为模板使用,时间复杂度是NlogN。//Time 32ms; Memory 568K#include #include using namespace std; int n; typedef struct point { double x,y; point(double xx=0,double yy=0):x(xx),y(yy){} }vector; poi... 阅读全文
posted @ 2013-07-25 08:10 C语言程序 阅读(222) 评论(0) 推荐(0)
摘要:// Time 46ms, Memory 328K#include #include using namespace std; double d; struct range { double l,r; }; range get(double a,double b) { range p; if(a60) p.r=60; if(p.l>p.r) p.l=p.r=0; return p; } range set(range a,range b) { range p; p.l=a.l>b.l?a.l:b.l; p.r=a.r>b.r?b.... 阅读全文
posted @ 2013-06-14 00:33 C语言程序 阅读(227) 评论(0) 推荐(0)
摘要:#include using namespace std; int main() { int a,b,s,t,i,j,k; while(cin>>a>>b>>s>>t && (a || b || s || t)) { if(a>s || (a==s && b>=t)) s+=12; k=0; for(i=0;;i++) { j=(a+i)%12; if(a+i>s || (a+i==s && j*6>t*1.1)) break; if(... 阅读全文
posted @ 2013-06-14 00:29 C语言程序 阅读(127) 评论(0) 推荐(0)
摘要:#include #include int a[100000][2],vis[100000],i,count; int f(int p,int k) { int j,t; for(j=k+1;j-ki) t=j-i-1; else t=j; if(p==a[t][0] && !vis[a[t][1]]) { vis[a[t][1]]=1;count++; if(f(a[t][1],t)==0) return 0; } else if(p==a[t][... 阅读全文
posted @ 2013-06-12 08:23 C语言程序 阅读(184) 评论(0) 推荐(0)
摘要://Time 531ms,Memory 1228K#include #include int map[50][50][50],t,t1,vis[50][50][50],dx[6]={0,0,0,0,1,-1},dy[6]={0,1,0,-1,0,0},dz[6]={1,0,-1,0,0,0},a,b,c; void f(int x,int y,int z) { int i,nx,ny,nz;t1++; for(i=0;ia-1 || nyb-1 || nzc-1 || map[nx][ny][nz]==1) continue; if(vis[nx][ny][nz... 阅读全文
posted @ 2013-06-12 08:17 C语言程序 阅读(179) 评论(0) 推荐(0)
摘要:#include #include using namespace std; typedef struct point { double x,y; point(double x=0.0,double y=0.0):x(x),y(y){} }vector; point p[1000010],c; vector operator - (point a,point b) {return vector(a.x-b.x,a.y-b.y);} point operator + (point a,point b) {return point(a.x+b.x,a.y+b.y);} point ... 阅读全文
posted @ 2013-06-11 18:20 C语言程序 阅读(216) 评论(0) 推荐(0)
摘要:#include __int64 gcd(__int64 a,__int64 b) { return b==0?a:gcd(b,a%b); } int main() { int i,j,prime[]={2,3,5,7,11,13,17,19},n,t; __int64 s1,s2,m,d,gd; while(scanf("%d",&n)==1) { s2=1;s1=0;t=0; if(n==21 || n==22) { for(i=2;id) { ... 阅读全文
posted @ 2013-06-11 18:15 C语言程序 阅读(231) 评论(0) 推荐(0)
摘要:#include #include int map[105][105],vis[105][105],ans,n,father[105]; int find(int x) { while(x!=father[x]) x=father[x]; return x; } int main() { int i,j,k,a,b,d,t,min1,min2,state,tt,num; while(scanf("%d",&n)==1 && n) { memset(vis,0,sizeof(vis)); memset(map... 阅读全文
posted @ 2013-06-08 13:45 C语言程序 阅读(153) 评论(0) 推荐(0)
摘要:#include int main(void) { int n, i; __int64 g[34] = {1}; __int64 d[34] = {0}; for (i = 1; i < 34; i++) { g[i] = 3 * g[i - 1] + 2 * d[i - 1]; d[i] = g[i - 1] + d[i - 1]; } while (scanf("%d", &n), n != -1) printf("%I64d, %I64d\n", g[n], d[n]); re... 阅读全文
posted @ 2013-06-08 13:38 C语言程序 阅读(192) 评论(0) 推荐(0)
摘要:#include int main() { __int64 i,n,a[36],j=0; a[1]=2; for(i=2;i<36;i++) { a[i]=2*(a[i-1]*2-a[i-1]*3/(i+1)); } while(scanf("%I64d",&n)==1 && n!=-1) { j++; printf("%I64d %I64d ",j,n); printf("%I64d\n",a[n]); } return 0; } 阅读全文
posted @ 2013-06-07 14:09 C语言程序 阅读(265) 评论(0) 推荐(0)
摘要:#include #include int map[510][510],vis[510],a[510],b[510],n,m,k; int f1(int u) { int v; for(v=1;v<=n;v++) { if(map[u][v] && !vis[v]) { vis[v]=1; if(!b[v] || f1(b[v])) { a[u]=v;b[v]=u;return 1; } } ... 阅读全文
posted @ 2013-06-07 14:06 C语言程序 阅读(264) 评论(0) 推荐(0)
摘要:#include #include #define N 8010 int main() { int i,j,k,n1,n2,n3,a[N],b[N],c[N]; while(scanf("%d%d%d",&n1,&n2,&n3)==3 && (n1 || n2 || n3)) { memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); memset(c,0,sizeof(c));k=0; for(i=0;i<=n1;i++) a[i]=1; ... 阅读全文
posted @ 2013-06-07 14:04 C语言程序 阅读(178) 评论(0) 推荐(0)
摘要:#include int main() { int i,n,c; double a[21]; a[1]=0;a[2]=1; for(i=3;i1;i--) a[n]/=i; printf("%.2lf%%\n",a[n]*100.0); } return 0; } 阅读全文
posted @ 2013-06-07 14:00 C语言程序 阅读(228) 评论(0) 推荐(0)
摘要:#include int main() { int i,n,x[100],y[100]; double s; while(scanf("%d",&n)==1 && n) { s=0.0; for(i=0;i<n;i++) scanf("%d%d",&x[i],&y[i]); for(i=1;i<n-1;i++) { s+=x[0]*(y[i]-y[i+1])+x[i]*(y[i+1]-y[0])+x[i+1]*(y[0]-y[i]); ... 阅读全文
posted @ 2013-06-07 13:57 C语言程序 阅读(389) 评论(0) 推荐(0)
摘要:#include #include #include #include using namespace std; int main() { int i,j,k,n,d,x,l,a; char s[35],p[35],m[65],c[65]; while(scanf("%d",&x)!=EOF && x) { getchar(); gets(s); gets(p); gets(c); l=strlen(s); n=strlen(c); d=((int)pow(n*1.0,1.5)+x)%n; memset(m,0,sizeof(m)); for(i=0 阅读全文
posted @ 2013-06-05 20:07 C语言程序 阅读(224) 评论(0) 推荐(0)

木其网络科技专业程序员代写http://www.xmsydw.com
程序员学历擅长经验网店链接
apenny硕士ASP.NET PHP 电子 通信设计 图像 编程 网络5年进入店铺
zheng_qianqian本科C语言 C++面向对象 Java3年进入店铺
guoguanl本科Java Web项目 JSP Hibernate Struts Mysql4年进入店铺