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
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
同上一题一样,记录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