摘要: http://acm.ccucomp.cn/acmhome/problemdetail.do?&method=showdetail&id=1100下面代码错了!!!!只是在学校oj上面ac了#include <iostream>#include <math.h>using namespace std;typedef struct node{ int pre; int next; int v;}Lan;Lan lan[50001];int Find(int n){ int f; f=n; while(f!=lan[f].v) f=lan[f].v... 阅读全文
posted @ 2012-03-31 14:14 orangeblog 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 搜索加记录平方数众所周知,一个正整数可以分成若干个正整数的和(废话),现在我们把问题改一下。把一个正整数分成若干个平方数的和,显然这也是一定可以达到的。例如8=4+4=2^2+2^2 41=4^2+5^2 3=1+1+1。但是现在试卷空格有限,不可能让你写n个1上去,所以我们需要最少的分拆。#include <iostream>#include <math.h>using namespace std;int base[320];int ans[300];int res[300];int rlen;int len;int back(int n,int temp){ //c 阅读全文
posted @ 2012-03-31 08:57 orangeblog 阅读(278) 评论(0) 推荐(0) 编辑