View Code #include<stdio.h>#include<string>#include<stack> using namespace std;int main(){ int m,i,j,k; char ch[1000],map[]="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int t; scanf("%d",&t); while(t--){ __int64 n=0; stack<int>s; scanf("%d%d%s",&a Read More
posted @ 2012-02-14 20:35 Because Of You Views(220) Comments(0) Diggs(0) Edit
View Code #include <iostream>#include <fstream>#include <cstring>#include <cmath>#include<cstdio>using namespace std;long long prime[16]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};long long bestSum;long long bestRes;long long N;void work(long long res,long long sum,int Read More
posted @ 2012-02-14 17:41 Because Of You Views(183) Comments(0) Diggs(1) Edit
同上一题一样,记录dfs遍历的序列,然后再利用树状数组快速求和调了好久呢View Code #include<cstdio>#include<stack>#include<cstring>using namespace std;stack<int> ss;const int maxn = 100010;struct EDGE{ int v,next;}edge[maxn*2];int exis[maxn],head[maxn],l[maxn],r[maxn],seq[maxn*2],re[maxn],c[maxn*2],cnt;bool vis[ Read More
posted @ 2012-02-14 14:20 Because Of You Views(227) Comments(0) Diggs(0) Edit