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

05 2013 档案

摘要:// Time 15ms, Memory 228K#include #include using namespace std; int main() { int i,m,k; while(scanf("%d",&m) && m) { int ans=0; for(i=0;i<m;i++) { scanf("%d",&k); ans^=k; } if(ans) printf("Rabbit Win!\n"); else print... 阅读全文
posted @ 2013-05-30 11:18 C语言程序 阅读(137) 评论(0) 推荐(0) 编辑
摘要://Time 0ms, Memory 228K#include #include #include using namespace std; int main() { int t,j,n,m,ans; while(scanf("%d%d",&n,&m)!=EOF) { ans=0; for(int i=0;i<n;i++) { scanf("%d%d",&t,&j); m=abs(t-j)-1; ans^=m; } if... 阅读全文
posted @ 2013-05-30 11:07 C语言程序 阅读(121) 评论(0) 推荐(0) 编辑
摘要:// Time 0ms, Memory 236K#include #include #include #include using namespace std; int fb[16],sg[1001],v[1001]; int mex(int x) { if(sg[x]!=-1) return sg[x]; int i; memset(v,0,sizeof(v)); for(i=1;i=0;i++) { sg[x-fb[i]]=mex(x-fb[i]); v[sg[x-fb[i]]]=1; } for(i=... 阅读全文
posted @ 2013-05-30 11:04 C语言程序 阅读(189) 评论(0) 推荐(0) 编辑
摘要://Time 0ms, Memory 288K#include #include using namespace std; int mex(int s,int c) { int q=sqrt(s*1.0); while(q+q*q>=s) q--; if(q>n && n) { int ans=0; for(i=0;i>s>>c; ans^=mex(s,c); } cout<<"Case "<<t++<<":"<<endl; if(ans) cout<&l 阅读全文
posted @ 2013-05-29 21:53 C语言程序 阅读(186) 评论(0) 推荐(0) 编辑
摘要:问题:在纯ubuntu环境下工作,需要访问windows环境下搭建的服务器,没有ftp服务,就是可以通过IP地址直接访问目录的那种;解决办法:1. ubuntu的nautilus中选择File--->Connect to Server...,在窗口Connect to Server中,选择type为Windows share,在Server中输入需要访问的文件服务器的IP地址,点击Connect,成功连接。问题解决。 阅读全文
posted @ 2013-05-29 02:41 C语言程序 阅读(217) 评论(0) 推荐(0) 编辑
摘要:要求就是:1、将当前目录中的所有“子目录”的权限设置为755;2、将当前目录中的所有“文件”的权限设置为644。解决方法:chmod 644 -R *chmod 755 `find -type d`也可以用:用find彻底些find /path -type f -exec chmod 644 {} /;find /path -type d -exec chmod 755 {} /;在linux中的每一个文件或目录都包含有访问权限,这些访问权限决定了谁能访问和如何访问这些文件和目录。通过设定权限可以从以下三种访问方式限制访问权限:只允许用户自己访问;允许一个预先指定的用户组中的用户访问;允许系统 阅读全文
posted @ 2013-05-29 01:50 C语言程序 阅读(3429) 评论(0) 推荐(0) 编辑
摘要:这题我先建了表来做的。可以进行两个操作:1、把其中一个数变为比它小的数;2、把其中一个数字0及其右边的所以数字删除。两人轮流进行操作,//Time 281ms, Memory 4140#include #include #include using namespace std; const int maxn=1000000; int sg[maxn]={0}; int len(int n) { if(n/100000) return 6; if(n/10000) return 5; if(n/1000) return 4; if(n/100) return 3;... 阅读全文
posted @ 2013-05-28 16:09 C语言程序 阅读(156) 评论(0) 推荐(0) 编辑
摘要:http://www.bo-ke-blog.net/2010/08/07/如何解决ubuntu下用wine报-cant-find-mfc42-dll-balabala问题/如何解决UBUNTU下用WINE报 “CAN’T FIND MFC42.DLL….BALABALA”问题错误原因:老winpe程序使用了mfc相关动态链接库,而新版的wine中不含此库,win用户可以通过安装 Microsoft Visual C++ Redistributable Package获取相关库ubuntu下获取此库方法:下载 winetricks:wget http://www.kegel.com/wine/w 阅读全文
posted @ 2013-05-28 09:11 C语言程序 阅读(214) 评论(0) 推荐(0) 编辑
摘要:问题:ubuntu 12.04环境下,使用ubuntu software center安装Adobe flash plugin,不知为什么,在到达约75%的进度的时候,莫名其妙地卡住了,然后,原来的执行任务之外又多了一个searching的任务,而且,点击searching右边的差号,只看到searching的状态变为Cancelling,等待良久,约有2个多小时吧,还是处在该状态不动。原来的安装adobe flash plugin的任务则通过点击任务条右边的差号已经杀掉了。解决办法:1. 放狗搜不解决问题了。sogou中基本上找不到有价值的帮助信息。2. 换用google.com,试了以下方 阅读全文
posted @ 2013-05-28 05:09 C语言程序 阅读(284) 评论(0) 推荐(0) 编辑
摘要:对于本题,若要当前的 player 赢,剩下所走的步数必须是奇数步。所以对于每步的 player 所放弃的选择的步数为偶数步。因此,对于整个 game 来说,所放弃的步数 m 为偶数步,设所走的步数为 k ,则 n*n-1=m+k;即 n 的奇偶性决定了 k 的奇偶性,也就决定了输赢。(如果有误,请提示!!谢了!!!!)代码如下://Time 0ms, Memory 280K #include using namespace std; int main() { int n; while(cin>>n && n) { if(n%2) cout<<" 阅读全文
posted @ 2013-05-27 13:07 C语言程序 阅读(173) 评论(0) 推荐(0) 编辑
摘要:问题:c++中输出通常信息的函数为cout,比如:std::cout 用于对cout进行重定向,操作符2>对cerr进行重定向。因为,系统的SHELL里一般约定1为正确流,2为错误流。而1是作为缺省值使用可以省略不写。2. 示例代码:# test_cerr.cpp#include using namespace std; int main() { cout test_cerr.txthello world---coutu1204@u1204-zhw:~/wrk/tmp/cpp_src/cpp_exer$ ./test_cerr > test_cout.txthello worl.. 阅读全文
posted @ 2013-05-27 11:13 C语言程序 阅读(1929) 评论(0) 推荐(0) 编辑
摘要://Time 78ms, Memory 280K#include using namespace std; int main() { int i,a,b,k; while(cin>>a>>b && (a || b)) { k=0; if(a1) { k++;break; } i=b;b=a%b;a=i;k++; } if(k%2) cout<<"Stan wins"<<endl; else... 阅读全文
posted @ 2013-05-27 08:41 C语言程序 阅读(142) 评论(0) 推荐(0) 编辑
摘要:pthread_create()在使用的过程中遇到的一个问题: 今天在使用线程的时候出现了一个问题,利用valgrind监测程序的运行时出现了memory leak。感觉到很奇怪,这样的情况应该不会发生的啊,毕竟是系统的函数。去网上搜了下,发现国内国外都有这个问题 呵呵。大概了解了下原因:创建的线程需要进行join或者detach状态,这样才能保证创建线程过程中分配的内存得以释放,才能避免memory leak的情况。因此,记得需要将线程进行join或者detach。 线程的分离状态决定一个线程以什么样的方式来终止自己。线程的默认属性是非分离状态,这种情况下,原有的线程等待创建的线程结束。只. 阅读全文
posted @ 2013-05-26 22:27 C语言程序 阅读(590) 评论(0) 推荐(0) 编辑
摘要:\\Time 31ms, Memory 4312K#include #include #include using namespace std; int n,p[1010][1010],sg[1010],b[1010]; int mex(int x) { if(sg[x]!=-1) return sg[x]; if(b[x]==0) return 0; int i,v[1010]; memset(v,0,sizeof(v)); for(i=0;i<b[x];i++) { sg[p[x][i]]=mex(p[x][i]); ... 阅读全文
posted @ 2013-05-26 22:10 C语言程序 阅读(154) 评论(0) 推荐(0) 编辑
摘要://Time 0ms, Memory 280K#include using namespace std; int main() { int n,t; while(cin>>n) { t=18; while(t=n) cout<<"Stan wins."<<endl; else cout<<"Ollie wins."<<endl; } return 0; } 阅读全文
posted @ 2013-05-25 21:52 C语言程序 阅读(123) 评论(0) 推荐(0) 编辑
摘要://Time 187ms, Memory 808K#include #include #include using namespace std; int s[101],h,ans[101],k,m,sg[10010]; int mex(int x) { if(sg[x]!=-1) return sg[x]; int i,v[101]; memset(v,0,sizeof(v)); for(i=0;i>k && k) { for(int i=0;i>s[i]; } sort(s,s+k); m... 阅读全文
posted @ 2013-05-25 21:22 C语言程序 阅读(166) 评论(0) 推荐(0) 编辑
摘要:阅读本篇之前推荐阅读以下姊妹篇:《秒杀多线程第四篇一个经典的多线程同步问题》《秒杀多线程第五篇经典线程同步关键段CS》《秒杀多线程第六篇经典线程同步事件Event》《秒杀多线程第七篇经典线程同步互斥量Mutex》《秒杀多线程第八篇经典线程同步信号量Semaphore》《秒杀多线程第九篇经典线程同步总结关键段事件互斥量信号量》《秒杀多线程第十篇生产者消费者问题》《秒杀多线程第十一篇读者写者问题》上面的文章讲解了在Windows系统下实现多线程同步互斥的方法,为了提高在实际问题中分析和思考多个线程之间同步互斥问题的能力,接下来将讲解PV操作,这也是操作系统中的重点和难点。本文将会先简要介绍下PV操 阅读全文
posted @ 2013-05-25 15:29 C语言程序 阅读(827) 评论(0) 推荐(0) 编辑
摘要://Time 15ms, Memory 292K#include using namespace std; int main() { int n,a[101],t; while(cin>>n && n) { t=0; for(int i=0;i>a[i]; t^=a[i]; } if(t) { int cnt=0; for(int i=0;i=0) cnt++;//注意,大于号的优先级要高于异或运算! ... 阅读全文
posted @ 2013-05-25 10:19 C语言程序 阅读(122) 评论(0) 推荐(0) 编辑
摘要:这是一道简单的博弈题。刚开始我用建表的方法来做,代码如下://Time 31ms, Memory 15920K #include #include using namespace std; int a[2001][2001]; int main() { int i,j,n,m,t; memset(a,0,sizeof(a)); for(i=0;i>n>>m && (n || m)) { if(a[n-1][m-1]) cout int main() { int n,m; while(scanf("%d%d",&n,&m)== 阅读全文
posted @ 2013-05-25 08:29 C语言程序 阅读(185) 评论(0) 推荐(0) 编辑
摘要:博弈论:是二人或多人在平等的对局中各自利用对方的策略变换自己的对抗策略,达到取胜目标的理论。博弈论是研究互动决策的理论。博弈可以分析自己与对手的利弊关系,从而确立自己在博弈中的优势,因此有不少博弈理论,可以帮助对弈者分析局势,从而采取相应策略,最终达到取胜的目的。博弈论分类:(摘自百度百科)(一)巴什博奕(Bash Game):只有一堆n个物品,两个人轮流从这堆物品中取物,规定每次至少取一个,最多取m个。最后取光者得胜。 显然,如果n=m+1,那么由于一次最多只能取m个,所以,无论先取者拿走多少个,后取者都能够一次拿走剩余的物品,后者取胜。因此我们发现了如何取胜的法则:如果n=(m+1)*r. 阅读全文
posted @ 2013-05-24 20:09 C语言程序 阅读(2987) 评论(0) 推荐(0) 编辑
摘要:问题:需要在ubuntu 12.04下面安装eclipse为C/C++开发者使用的IDE,作为编写c/c++代码的IDE环境。解决办法:1. eclipse是一个Java应用程序,这使它可以跨平台。这意味着eclipse只能在Java虚拟机上运行。所以,首先,安装配置JDK(Java Developping Kit);2. 下载eclipse cdt,从http://www.eclipse.org/downloads/下载Eclipse IDE for C/C++ Developers ,文件eclipse-cpp-juno-SR2-linux-gtk.tar.gz;3. 解压:tar xvf 阅读全文
posted @ 2013-05-24 18:45 C语言程序 阅读(241) 评论(0) 推荐(0) 编辑
摘要:问题:ubuntu 12.04中安装gvim后,用gvim打开文件main.cpp,提示:** (gvim:20320): WARNING **: Unable to create Ubuntu Menu Proxy: Timeout was reached解决办法:1. 放狗搜,查到这样一个办法:在~/.bashrc文件中追加:functiongvim(){(/usr/bin/gvim-f"$@"&)}更改.bashrc文件,在terminal中使用source ~/.bashrc更新改动;再次使用gvim打开main.cpp文件,问题解决。至此,问题解决。 阅读全文
posted @ 2013-05-24 13:17 C语言程序 阅读(270) 评论(0) 推荐(0) 编辑
摘要:卸载以前版本必须把注册表里面的source insight有关项全部删除,然后重新安装,否则没有输入注册码的界面,注册码是:SI3US-719473-71478,造福群众。原文地址:http://blog.csdn.net/gexueyuan/article/details/7712020 阅读全文
posted @ 2013-05-23 23:10 C语言程序 阅读(185) 评论(0) 推荐(0) 编辑
摘要:ipkg 是 OpenWrt 内的一个软件安装管理工具,在 OpenWrt 内输入root@Linksys:~# ipkg你会得到 ipkg 的说明和帮助,接下来我会说明 ipkg 常用的几个命令:1. ipkg updateipkg 会到http://downloads.openwrt.org/whiterussian/packages/下载并更新最新的软件包列表(这个列表的位置在/etc/ipkg.conf指定):ipkg upgrade 更新所有已安装软件root@Linksys:~# ipkg updateDownloadinghttp://downloads.openwrt.org/ 阅读全文
posted @ 2013-05-22 16:05 C语言程序 阅读(1093) 评论(0) 推荐(0) 编辑
摘要:ntpd、ntpdate的区别使用之前得弄清楚一个问题,ntpd与ntpdate在更新时间时有什么区别。ntpd不仅仅是时间同步服务器,他还可以做客户端与标准时间服务器进行同步时间,而且是平滑同步,并非ntpdate立即同步,在生产环境中慎用ntpdate,也正如此两者不可同时运行。时钟的跃变,对于某些程序会导致很严重的问题。许多应用程序依赖连续的时钟——毕竟,这是一项常见的假定,即,取得的时间是线性的,一些操作,例如数据库事务,通常会地依赖这样的事实:时间不会往回跳跃。不幸的是,ntpdate调整时间的方式就是我们所说的”跃变“:在获得一个时间之后,ntpdate使用settimeofday 阅读全文
posted @ 2013-05-22 15:17 C语言程序 阅读(757) 评论(0) 推荐(0) 编辑
摘要:#include #include #include char ch[20]; int j[1000010]; void set() { int i; j[0]=0; for(i=1;i<=1000010;i++) { j[i]=j[i-1]; itoa(i,ch,10); if((strstr(ch,"62")!=NULL)||(strstr(ch,"4")!=NULL)) continue; else j[i]++; } } int m... 阅读全文
posted @ 2013-05-21 14:45 C语言程序 阅读(451) 评论(0) 推荐(0) 编辑
摘要:#include #define N 100 void main() { int i,n; double a[N]; while(scanf("%d",&n)==1) { int x=0,y=0,z=0; if(n==0) continue; for(i=0;i<n;i++) { scanf("%lf",&a[i]); if(a[i]<0) x++; else if(a[i]==0) y+... 阅读全文
posted @ 2013-05-21 14:27 C语言程序 阅读(140) 评论(0) 推荐(0) 编辑
摘要:这年我九岁,我爸妈都去了外地打工,而姐姐和我都交给了姨娘姨夫来带。这年暑假,我姨娘家的一只老母鸡开始了第二次孵小鸡的工作。但是,也许是因为它太累了,或者是太懒了,最后就剩下三个蛋没来得及孵出小鸡了,然后它就放弃了。于是,我姨就每天把那三个蛋放到外面日头底下嗮。最后还真的”孵“出了一只来。开始几天,我姨试图着让那只老母鸡能把这只给带上。但每次把这只小鸡推到小鸡群后,那只老母鸡都会把它赶走。所以,没天都是它一个人呆着。于是我又开始照顾它,慢慢地,我又和它熟了。它不像我之前的那只小鸡一样,它整天都跟着我。它也喜欢飞到我身上来;有一次,它还不小心地装进了我的衣服里面,差点被闷着。让我更可气的是,每天我 阅读全文
posted @ 2013-05-20 16:48 C语言程序 阅读(159) 评论(0) 推荐(0) 编辑
摘要:题意大概是这样的:用一个7位的string代表一个编号,两个编号之间的distance代表这两个编号之间不同字母的个数。一个编号只能由另一个编号“衍生”出来,代价是这两个编号之间相应的distance,现在要找出一个“衍生”方案,使得总代价最小,也就是distance之和最小。#include #include using namespace std; int map[2010][2010],vis[2010],n,sum; void f(int t) { int i,j=n-2,min=0; while(j--) { for(i=1;imap[t][i]) map[0][i]=ma... 阅读全文
posted @ 2013-05-19 16:59 C语言程序 阅读(88) 评论(0) 推荐(0) 编辑
摘要://Time 297ms, Memory 640K#include using namespace std; int n,m; int money[100010]; int judge(int mid) { int i,s=0,group=1; for(i=0;im) return 0; } return 1; } int main() { int i,max,min,mid; while(cin>>n>>m) { max=min=0; for(i=0;i>money[i]; max+=money[i]; if(min<money[i]) min=mo... 阅读全文
posted @ 2013-05-19 16:49 C语言程序 阅读(196) 评论(0) 推荐(0) 编辑
摘要:这是发生在我七岁那年,那是快接近夏天了,那天傍晚我们都在家门口玩。突然有一个人拉着小车进了我们村,嘴里一直大声地嚷着:“买鸡咯!。。。”这时,我妈也出来了。我心里想着,多么希望妈妈买鸡啊。诶,妈妈还真的买了十只。养了一来个月后,小鸡都快长尾巴毛了。但突然来了瘟疫,断断续续地死了九只。还算最后一只命劳,还好好的。但是,就剩下它一个人了,显得很孤单,可怜。于是我天天负责它的饮食。刚开始的时候,它谁都怕。我给它吃的,它都跑得远远的。但慢慢地,它知道我不会对它造成危害,于是跟我熟了。有一天,我忘了按时喂它了,我想起后便匆忙回家,用手抓了一把米;我刚把手摊开,还没来得及把米放到地上,它便奔了过来在我手上 阅读全文
posted @ 2013-05-19 13:37 C语言程序 阅读(211) 评论(0) 推荐(0) 编辑
摘要:那是在我五岁的时候,那年我妈妈去了外地打工,就剩下爸爸在家靠骑黄包车来养活我。有一天,爸爸带着一只黄毛小鸭回来。他告诉我说是从一辆装运鸭子的大货车上掉下来的,他恰好经过,于是就把它带了回来。爸爸还嘱咐我说:“等妈妈回来了,你就跟她说,鸭子是买的,一共买了两只,死了一只。”我不解地点了点头。由于爸爸要出去踩车子,所以从此以后都是我来看着这只可怜的鸭子。慢慢地我跟它熟了,它也不怕我了;整天都围着我,跟着我。后来有一天,我和爸爸要去外婆家。当我坐上车的时候,我便有点后悔没把它也带来。。。到了那天傍晚,我们终于回来了。刚到家,我就叫爸爸就把柴房门打开,鸭子还关在里面呢!但是,当把门打开的时候,里面什么 阅读全文
posted @ 2013-05-19 12:22 C语言程序 阅读(113) 评论(0) 推荐(0) 编辑
摘要:// Time 16ms, Memory 328K#include using namespace std; const int size=10000; const int mod=9901; __int64 sum(__int64 p,__int64 n); //递归二分求 (1 + p + p^2 + p^3 +...+ p^n)%mod __int64 power(__int64 p,__int64 n); //反复平方法求 (p^n)%mod int main(void) { int A,B; int p[siz... 阅读全文
posted @ 2013-05-19 09:14 C语言程序 阅读(171) 评论(0) 推荐(0) 编辑
摘要://Time 907ms, Memory 4480K#include #include using namespace std; int vis[1000010],prime[80000]; int main() { int i,j,k=0,l,a[35],t; char s[105]; memset(vis,0,sizeof(vis)); memset(s,0,sizeof(s)); for(i=2;i*i>s>>l && ((strlen(s)!=1 || s[0]!='0') || l)) { j=0;i=strlen(s); for(i 阅读全文
posted @ 2013-05-19 09:09 C语言程序 阅读(157) 评论(0) 推荐(0) 编辑
摘要://Time 47ms, Memory 308K#include #include #include using namespace std; const int inf=0xfffffff; queueq; int cap[55][55],flow[55][55],d[2505],e[2505],n,p,cnt=0,vis[55][55]; void f1(int i) { int j; for(j=1;j0 && !vis[i][j]) { vis[i][j]=1; if(i) { cnt++;... 阅读全文
posted @ 2013-05-19 09:03 C语言程序 阅读(124) 评论(0) 推荐(0) 编辑
摘要://Time 63ms, Memory 572K#include #include #include using namespace std; class coordinate { public: double x,y; }point[201]; double path[201][201]; //两点间的权值 int main(void) { int i,j,k; int cases=1; while(cases) { /*Read in*/ ... 阅读全文
posted @ 2013-05-19 08:58 C语言程序 阅读(116) 评论(0) 推荐(0) 编辑
摘要://Time 250ms, Memory 332K#include #include using namespace std; int cnt,n,m1,m2; struct point { int a,b; double t; point(int a=0,int b=0,double t=0.0):a(a),b(b),t(t){} }p[6000]; int bellman() { int i,j; int flag; double dis[505]; for(i=0;idis[p[j].a]+p[j].t) {... 阅读全文
posted @ 2013-05-19 08:55 C语言程序 阅读(140) 评论(0) 推荐(0) 编辑
摘要://Time 16ms, Memory 244K#include #include using namespace std; int cnt,n,m,s; double v; struct point { int a,b; double r,c; point(int a=0,int b=0,double r=0.0,double c=0.0):a(a),b(b),r(r),c(c){} }p[201]; int bellman() { int i,j; int flag; double dis[101]; memset(dis,0,siz... 阅读全文
posted @ 2013-05-19 08:49 C语言程序 阅读(172) 评论(0) 推荐(0) 编辑
摘要://Time 0ms, Memory 568KB#include #include #include using namespace std; const double pi=2.0*asin(1.0); int main() { double a,b,h,v; int t,i=1; cin>>t; while(t--) { cin>>a>>b>>h; if(h>b) h=b; v=pi*a*b*(h-h*h*h/(3*b*b)+2*b/3); cout<<"Case "<<i++<< 阅读全文
posted @ 2013-05-18 21:25 C语言程序 阅读(132) 评论(0) 推荐(0) 编辑
摘要:最大流-多源多汇问题建立超级源点,超级汇点#include #include #include #include using namespace std; const int inf=0xfffffff; queueq; int n,np,nc,m,s,t; int cap[105][105],flow[105][105],d[105],g[105][105]; int main() { int i,a,b,c,f,ss; char s1,s2,s3; while(cin>>n>>np>>nc>>m) { s=n;t=n+1; m... 阅读全文
posted @ 2013-05-18 19:48 C语言程序 阅读(176) 评论(0) 推荐(0) 编辑
摘要:#include #include #include #include using namespace std; struct Point { double x,y; }; struct Segment { Point p1,p2; }; double cross(const Point& o,const Point & a,const Point& b) { return (a.x - o.x)*(b.y-o.y) - (a.y - o.y)* (b.x - o.x); } ... 阅读全文
posted @ 2013-05-18 19:43 C语言程序 阅读(218) 评论(0) 推荐(0) 编辑
摘要:#include #include #include using namespace std; int n,d,ans; struct point { int x,y; }p[1010]; bool operator temp) t=temp; else if(p[i].y*p[i].y+(t-p[i].x)*(t-p[i].x)>n>>d && (n||d)) {ok=1; for(i=0;i>p[i].x>>p[i].y; if(p[i].y>d) ok=0; } ... 阅读全文
posted @ 2013-05-18 19:41 C语言程序 阅读(262) 评论(0) 推荐(0) 编辑
摘要:#include #include using namespace std; const double PI=acos(-1.0); int n,l; typedef struct point { double x,y; point(double xx=0,double yy=0):x(xx),y(yy){} }vector; point p[1010],q[1010]; void sort1(point *a,int x,int y,point *t) { int m,u,v,i; if(y-x>1) { m=x+(y-x)/2; u=x,v=m,i=x; sort1(... 阅读全文
posted @ 2013-05-18 19:34 C语言程序 阅读(103) 评论(0) 推荐(0) 编辑
摘要:最短路问题#include #include using namespace std; const int inf=0xfffffff; int dis[101],vis[101],map[101][101],v[101]; int n,m; int dijkstra() { int i,j,sd,node; for(i=1;idis[j]) { sd=dis[j];node=j; } } if(node==0) break; vis[node]=1;... 阅读全文
posted @ 2013-05-18 19:25 C语言程序 阅读(120) 评论(0) 推荐(0) 编辑
摘要:#include #include #include #include #include using namespace std; const int MAXN=330; const double eps=1e-4; double p[MAXN][2]; double xx1,yy1,xx2,yy2; double dis(int i,int j) { return sqrt((p[i][0]-p[j][0])*(p[i][0]-p[j][0])+(p[i][1]-p[j][1])*(p[i][1]-p[j][1])); } void get_center_point(int a... 阅读全文
posted @ 2013-05-18 19:20 C语言程序 阅读(146) 评论(0) 推荐(0) 编辑
摘要:#include #include #include using namespace std; int a[65],vis[65],n; int dfs(int len,int li,int s,int num) { int sam=-1,i; if(num==n) return 1; for(i=s;i>=0;i--) { if(vis[i] || a[i]==sam) continue; vis[i]=1; if(len+a[i]>n && n) { sum=0; for(i=0;i>a[i]; sum+=a[i]; vis[i]=0; } ... 阅读全文
posted @ 2013-05-18 19:17 C语言程序 阅读(471) 评论(0) 推荐(0) 编辑
摘要://Time 15ms,Memory 328K#include #include using namespace std; char city[4][5]; int n,vis[16]; int dfs(int i) { int c1,c2; for(;i=0 && city[j][y]=='.';j--) vis[j*n+y]++; for(int j=x+1;j=0 && city[x][j]=='.';j--) vis[x*n+j]++; for(int j=y+1;j=0 && city[j][y]==&# 阅读全文
posted @ 2013-05-18 15:53 C语言程序 阅读(163) 评论(0) 推荐(0) 编辑
摘要:这题也可以用搜索来做但用匹配做更简单//Time 0ms,Memory 332K#include #include using namespace std; char city[4][5]; int n,l1,l2,vis[10],flag[10],p[4][4],q[4][4],pq[10][10]; int f(int u) { int i; for(i=0;i>n && n) { l1=0;t=0; memset(p,0,sizeof(p)); memset(q,0,sizeof(q)); memse... 阅读全文
posted @ 2013-05-18 15:49 C语言程序 阅读(186) 评论(0) 推荐(0) 编辑
摘要:初期:一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. (5)构造法.(poj3295) (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996)二.图算法: (1)图的深度优先遍历和广度优先遍历. (2)最短路径算法(dijkstra,bellman-ford,floyd,heap+dijkstra) (poj1860,poj3259,poj1062,poj2253,poj1125,poj2240) (3)最小生成树... 阅读全文
posted @ 2013-05-18 07:55 C语言程序 阅读(218) 评论(0) 推荐(0) 编辑
摘要:GCD最大公约数int gcd(int x,int y) { if(!x || !y) return x>y?x:y; for(int t;t=x%y;x=y,y=t); return y; }快速GCDint kgcd(int a,int b) { if(a==0) return b; if(b==0) return a; if(!(a & 1) && !(b & 1)) return kgcd(a>>1,b>>1)>1); else if(!(a & 1)) return kgcd(a>>1,b); e 阅读全文
posted @ 2013-05-17 20:36 C语言程序 阅读(279) 评论(0) 推荐(0) 编辑
摘要:递推求欧拉函数phi(i):for(i=1;i1) res=res/x*(x-1); return res; } 阅读全文
posted @ 2013-05-17 20:27 C语言程序 阅读(723) 评论(0) 推荐(0) 编辑
摘要:问题:ubuntu下编写测试下标运算符[]重载的程序。使用while (cin >> buf)将接收到的字符串存储到string buf中,不知道该怎样结束cin的输入操作;解决办法:1. 放狗搜,结论是linux下使用Ctrl+d,windows下使用Ctrl+z来结束键盘输入。源程序如下:#include #include using namespace std; class Assoc { struct Pair { string name; double val; Pair (string n = "", double v... 阅读全文
posted @ 2013-05-17 20:10 C语言程序 阅读(830) 评论(0) 推荐(0) 编辑
摘要://Time 47ms,Memory 248k#include #include using namespace std; double d[22]; typedef struct point { double x,y; point(double x=0,double y=0):x(x),y(y){} }vector; point p[22]; double cross(vector a,vector b) { return a.x*b.y-a.y*b.x; } int f(int a,double s,point i,point j,double &right) { vector . 阅读全文
posted @ 2013-05-17 18:45 C语言程序 阅读(124) 评论(0) 推荐(0) 编辑
摘要://Time 0ms,Memory 504KB#include #include using namespace std; int v[25][25],p[25][25],m,n; int dfs(int cur,int d) { int x,y; x=cur/m+1;y=cur%m+1; if(cur>=n*m) return 1; if(y+dm) { if(x==n) { if(p[x][y]==0) return 1; else ret... 阅读全文
posted @ 2013-05-17 15:29 C语言程序 阅读(126) 评论(0) 推荐(0) 编辑
摘要:在写这篇技术blog时,我参看了 http://www.cnblogs.com/hoojo/archive/2011/04/22/2025197.html也可以看看这篇,写的挺细的,我写了一个xml 到 bean. 和bean 到xml 转换的一个例子,一来,作为成长的一个脚印,二来,准结一些代码,以后备用,在银行和保险方面,在接口的传送数据时,经常传送的是xml报文。有的加密,有你的明文,都同样需要这样一个转换的功能。所以来写这篇blog,主要是自己看,如果,别的攻城师 看到这篇blog,并学会了一些处理业务的方法,那是我的荣幸,我会非常的高兴。一、准备工作 1、 下载jar包、及官方资源 阅读全文
posted @ 2013-05-16 15:11 C语言程序 阅读(349) 评论(0) 推荐(0) 编辑
摘要:问题:vmware 9.0.2下新装ubuntu 13.04,安装完成后按照惯例添加共享目录。重启ubuntu 13.04,在/mnt/hgfs目录下看不到共享目录的名称。解决办法:1. 反复确定设定共享文件夹,并重启虚拟机多次,都不能在/mnt/hgfs目录下看到任何内容;2. 放狗搜,看到"小卷儿2008"给出的方案是:试一下1.sudo apt-get install open-vm-dkms 2.sudo mount -t vmhgfs .host:/ /mnt/hgfs将上述命令拷贝到虚拟机ubuntu 13.04中执行,完成后,david@ubuntu:~$ l 阅读全文
posted @ 2013-05-08 17:27 C语言程序 阅读(267) 评论(0) 推荐(0) 编辑
摘要:linux目录(?)[+]概述函数接口使用相关命令行接口概述:消息队列是linux下进程间通信的一种方式,一般用于传送少量数据,如果大量数据需要在进程间共享,则可以用共享内存。函数接口使用:linux下提供了以下几个接口,用于消息队列的使用,使用一般过程如下:1. 调用ftok接口产生一个key. 使用ftok的好处是,访问同一个消息队列的不同进程可以通过同一个文件访问相同的队列. 另外,如果文件被删除,即使重新产生后内容一模一样,仍然可能产生不同的key ,因为文件的inode与key值的产生有关。2. 调用msgget(使用key作为参数)产生一个队列3. 进程可以用msgsnd发送消息到 阅读全文
posted @ 2013-05-06 23:38 C语言程序 阅读(2259) 评论(0) 推荐(0) 编辑
摘要:ftok()#include#include函数原型:key_tftok(constchar*pathname,intproj_id);参数:pathname就是你指定的文件名(该文件必须是存在而且可以访问的),id是子序号,虽然为int,但是只有8个比特被使用(0-255)。返回值:成功时候返回key_t类型的key值,失败返回-1msgget#include#include#include函数原型:intmsgget(key_tkey,intmsgflg);函数描述:建立消息队列参数:msgget()函数的第一个参数是消息队列对象的关键字(key),函数将它与已有的消息队列对象的关键字进行 阅读全文
posted @ 2013-05-06 23:25 C语言程序 阅读(1756) 评论(0) 推荐(0) 编辑
摘要:问题:在虚拟机中编译老内核linux-2.6.24,通过sudo apt-get install linux-source-2.6.24后,得到linux-source-2.6.24.tar.bz2。解压到linux-source-2.6.24中,cd linux-source-2.6.24,执行sudo make oldconfig,出现错误提示:error: sys/types.h: No such file or directory解决办法:1. 放狗搜,查到types/types.h应该位于libc6-dev的package中,david@david-804: apt-cache se 阅读全文
posted @ 2013-05-04 15:16 C语言程序 阅读(4672) 评论(0) 推荐(0) 编辑
摘要:Dell服务器的bios设置和普通机器不太一样。在boot里面没法设置,不过在启动的时候有选项。描述:在选择完语言以后,进行下一步操作时出现“no common cd-rom drive was detected”的错误提示,百思不得其解。于是试着装了一下windows xp,没问题。再装ubuntu-server,再次出现同样的问题“no common cd-rom drive was detected”。难道是人品问题?再次做了个试验,通过u盘安装,结果依然是同样的问题。安装RedHat,结果依然是同样的问题因为本来需要的系统是solaris,所以又试了一下安装solaris,结果却毫无问 阅读全文
posted @ 2013-05-04 00:41 C语言程序 阅读(1478) 评论(0) 推荐(0) 编辑
摘要:EasyX很有趣,参考EasyX官网的文章,花了几个小时做了一个时钟程序,包含背景音乐、背景图片,时钟是模仿Iphone时钟设计的,可惜不像。系数调整的比较粗略,表针走的不是非常精确,另外以后再加上个程序图标。#include #include #include #include #pragma comment(lib, "Winmm.lib") // 引用 Windows Multimedia API #define PI 3.1415926 void Drawdail(void) { //大圆 setfillcolor(WHITE); fillcircle(250, 2 阅读全文
posted @ 2013-05-03 22:23 C语言程序 阅读(433) 评论(0) 推荐(0) 编辑

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