上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 455 下一页
Lost CowsTime Limit:1000MSMemory Limit:65536KTotal Submissions:8260Accepted:5269Description N (2 list=new LinkedList(); for(int i=1;i s1=new Stack(); while(--n>0) s1.add(input.nextInt()); Stack s=new Stack(); while(!s1.isEmpty()){ int a=s1.pop(); s.push(list.remove(a)); } Syste... Read More
posted @ 2013-08-02 23:03 javawebsoa Views(207) Comments(0) Diggs(0) Edit
来源:点击打开链接看上去数据规模很小,但是必须要剪枝,否则直接爆TLE。通过这个题可以练习奇偶剪枝。另外:还有一个优化方式,如果所有步数走完了门还没关,则直接返回结果"NO".#include #include #include #include using namespace std;int n,m,tarstep;int tari,tarj;int si,sj;char map[10][10];int dir[4][2]={0,1,0,-1,1,0,-1,0};int ok=0;void dfs(int si,int sj,int step){ int temp; if Read More
posted @ 2013-08-02 23:01 javawebsoa Views(200) Comments(0) Diggs(0) Edit
有时可能会遇到这样的问题,一个label中设置的文本含有2种以上不同的格式,又不能把它拆解为两个label来显示,这时用NSMutableAttributedString可以很好的解决问题。 示例如下:NSMutableAttributedString*text =[[NSMutableAttributedString alloc] initWithAttributedString: label.attributedText];[text addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSM Read More
posted @ 2013-08-02 22:59 javawebsoa Views(143) Comments(0) Diggs(0) Edit
简要记录了Qualcom MSM8xxx MDP Framebuffer驱动中的一些点。Framebuffer设备的sysfs330static int msm_fb_create_sysfs(struct platform_device *pdev)331{332 int rc;333 struct msm_fb_data_type *mfd = platform_get_drvdata(pdev);334335 rc = sysfs_create_group(&mfd->fbi->dev->kobj, &msm_fb_attr_group);336 if Read More
posted @ 2013-08-02 22:57 javawebsoa Views(1989) Comments(0) Diggs(0) Edit
class Solution {public: double powPositive(double x, int n){ if(n == 0) return 1; if(n == 1) return x; double tmp; if(n%2 == 0){ tmp = powPositive(x, n/2); return tmp*tmp; } tmp = powPositive(x, n/2); r... Read More
posted @ 2013-08-02 22:55 javawebsoa Views(214) Comments(0) Diggs(0) Edit
今天用到linux上的git安装过程比较曲折,记录一下: 首先会报需要perlrpm -ivh git-1.7.1-14.2.x86_64.rpmwarning: git-1.7.1-14.2.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID c428b69d: NOKEY error: Failed dependencies: perl is needed by git-1.7.1-14.2.x86_64 perl(Error) is needed by git-1.7.1-14.2.x86_64 perl(Git) ... Read More
posted @ 2013-08-02 22:53 javawebsoa Views(579) Comments(0) Diggs(0) Edit
做完后,看了解题报告,思路是一样的。我就直接粘过来吧 最终添加完边的图,肯定可以分成两个部X和Y,其中只有X到Y的边没有Y到X的边,那么要使得边数尽可能的多,则X部肯定是一个完全图,Y部也是,同时X部中每个点到Y部的每个点都有一条边,假设X部有x个点,Y部有y个点,有x+y=n,同时边数F=x*y+x*(x-1)+y*(y-1),整理得:F=N*N-N-x*y,当x+y为定值时,二者越接近,x*y越大,所以要使得边数最多,那么X部和Y部的点数的个数差距就要越大,所以首先对于给定的有向图缩点,对于缩点后的每个点,如果它的出度或者入度为0,那么它才有可能成为X部或者Y部,所以只要求缩点之后的... Read More
posted @ 2013-08-02 22:51 javawebsoa Views(178) Comments(0) Diggs(0) Edit
http://acm.hdu.edu.cn/showproblem.php?pid=4612Warm upTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 65535/65535 K (Java/Others) Total Submission(s): 2012Accepted Submission(s): 474 Problem Description N planets are connected by M bidirectional channels that allow instant transportation.... Read More
posted @ 2013-08-02 22:49 javawebsoa Views(207) Comments(0) Diggs(0) Edit
Ollivanders: Makers of Fine Wands since 382 BC. Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 520Accepted Submission(s): 294 Problem Description In Diagon Alley ,there is only one Wand-seller,peeling gold letters over the do... Read More
posted @ 2013-08-02 22:47 javawebsoa Views(392) Comments(0) Diggs(0) Edit
两个题目都是求区间之内,不重复的数字之和,3333需要离散化处理.................调试了一下午........说多了都是泪...........#include #include #include #include #include #include #include #include #include #include //形如INT_MAX一类的#define MAX 51111#define INF 0x7FFFFFFF#define L(x) x '9') ; ret = c - '0'; while((c=getchar()) > Read More
posted @ 2013-08-02 22:46 javawebsoa Views(232) Comments(0) Diggs(0) Edit
上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 455 下一页