二维树状数组
摘要:#include #include #include #include //#define y1 y11 using namespace std; const int maxn=1e3+10; int lowbit(int x){return x&(-x); } int a[maxn][maxn]; int b[maxn][maxn]; int n=1e3+9; void update(int ...
阅读全文
hdu6440 Dream(费马小定理)
摘要:保证 当 n^p=n(mod p) 是成立 只要保证n*m=n*m(mod p);
阅读全文
hdu6441 Find Integer (费马大定理)
摘要:#include using namespace std; int main() { int T; scanf("%d",&T); while(T--) { int n,a; scanf("%d %d",&n,&a); if(n==1) printf("%d %d\n",a,2*a); else if(n==2) ...
阅读全文
hdu5173 How Many Maos Does the Guanxi Worth
摘要:#include using namespace std; #define INF 0x3f3f3f3f int dis[35]; int visit[35]; int SSSP[35][35]; void dijkstra(int x,int n) { int pos; int minn; for(int i=1;i>n>>m; if(n==0&&m==0) ...
阅读全文
hdu 1556 A - Color the ball 其他做法
摘要:#include using namespace std; const int maxn=1e6+10; int c[maxn]; int n; int main() { while(1) { cin>>n; if(n==0) break; memset(c,0,sizeof(c)); for(int i=1;i>a...
阅读全文
hdu 1556 A - Color the ball 数状数组做法
摘要:#include<bits/stdc++.h> using namespace std; const int maxn=1e6+10; int n; int c[maxn]; int lowbit(int x) { return x&(-x); } void update(int num,int v
阅读全文