摘要: 就一个最小生成树。本蒟蒻还交了三次,最后才发现是数组开小了。。不能再刷水题了。。。Code:#include <iostream>#include <cstdio>using namespace std;const long maxn=999999999;long pre[301];long g[301][301];int v[301];int main(){ long n; cin >>n; pre[0]=0; for (int i=1;i<=n;i++){ cin >>g[0][i]; pre[i]=g[0][i]; v[i]=1; } 阅读全文
posted @ 2012-05-14 22:22 JS_Shining 阅读(446) 评论(0) 推荐(0) 编辑
摘要: 数论题,本人数学不好,怕讲不清楚。。发一个貌似官方的题解。Code:#include <cstdio>#include <iostream>using namespace std;int main(){ long long n,p,a,ans; while (cin >>n){ ans=n; for (long long i=2;i*i<=n;i++){ if (n%i==0) { p=i;a=0; while (n%p==0){ a++;n/=p; ... 阅读全文
posted @ 2012-05-14 22:14 JS_Shining 阅读(1704) 评论(0) 推荐(0) 编辑
摘要: 想法其实是挺巧妙的。。找到所有数的所有因数,统计最大的一个出现过K次的因数。Code:#include <cstdio>#include <iostream>using namespace std;long a[1001];long s[1000001];long gcd(long a,long b){ if (a%b==0) { return b; } if (b%a==0) { return a; } return gcd(b,a%b);}void qqsort(long l,long r){ long i=l,j=r,x; x=s[(l+r)/2]; /*cout 阅读全文
posted @ 2012-05-14 21:46 JS_Shining 阅读(521) 评论(0) 推荐(0) 编辑