http://acm.hdu.edu.cn/showproblem.php?pid=5685
#include <cstdio>#include<cstring>#include<algorithm>using namespacestd;Const intMAXN = 1e5 +5;intH[MAXN];CharHSTR[MAXN];intN, L, R;Const intMods =9973; typedefLong LongLL; ll Mod_pow (ll X, ll N, ll MoD) {ll res=1; while(N >0) { if(N &1) Res = res * x%MoD; X= x * x%MoD; N>>=1; } returnRes;}intMain () { while(~SCANF ("%d", &N)) {scanf ("%s", HSTR); intLen =strlen (HSTR); h[0] =1; for(inti =1; I <= Len;i + +) {H[i]= H[i-1] * (Hstr[i-1] - -) %mods; } while(N--) {scanf ("%d%d", &l, &S); if(L >r) Swap (L, R); printf ("%i64d\n", (LL) h[r] * MOD_POW (H[l-1], mods-2, mods)%mods); } } return 0;}/*#include <stdio.h> #include <string.h>char str[100010];int main () {int n,a,b,k,i,j,s,l; while (scanf ("%d", &n)!=eof) {memset (str,0,sizeof (str)); scanf ("%s", str); L = strlen (str); printf ("%d\n", L); for (k = 0;k<n;k++) {j = 1; scanf ("%d%d", &a,&b); for (i = A-1;i < b;i++) printf ("%d,", str[i]); printf ("\ n"); for (i = A-1;i < b;i++) {j = (str[i]-28)% 9973*j; } j = j% 9973; printf ("%d\n", j); }} return 0;}*/
http://acm.hdu.edu.cn/showproblem.php?pid=5686
#include <iostream>#include<stdio.h>#include<string.h>using namespacestd;inta[205][205];intMain () {memset (A,0,sizeof(a)); a[1][ $]=1; a[2][ $]=2; inti,j; for(i=3; i<= $; i++) { for(j= $;j>0; j--) {A[i][j]=a[i][j]+a[i-1][j]+a[i-2][j]; if(a[i][j]>9) {a[i][j-1]=a[i][j]/Ten; A[I][J]=a[i][j]%Ten; } } } intN; while(cin>>N) {j=0; while(a[n][j]==0) J + +; for(; j<= $; j + +) {cout<<A[n][j]; } cout<<Endl; } return 0;}
http://acm.hdu.edu.cn/showproblem.php?pid=5687
#include <cstdio>#include<cstring>#include<algorithm>using namespacestd;#defineFIN freopen ("Input.txt", "R", stdin)structnode{intnext[ -]; intv,s; voidInit () {v=s=0; Memset (Next,-1,sizeof(next)); }};structNode l[4000000];inttot=0;voidAddCharA[],intLen) { intnow=0; for(intI=0; i<len;i++){ inttmp=a[i]-'a'; intnext=L[now].next[tmp]; if(next==-1) {Next=++tot; L[next].init (); L[NEXT].V=-1; L[NOW].NEXT[TMP]=Next; } Now=Next; L[now].s++; } l[now].v=0;}BOOLQueryCharA[],intLen) { intnow=0; for(intI=0; i<len;i++){ inttmp=a[i]-'a'; intnext=L[now].next[tmp]; if(next==-1)return false; now=Next; } returnL[now].s >0;}voidDeletes (CharA[],intLen) { intnow=0, late; for(intI=0; i<len;i++){ inttmp=a[i]-'a'; intnext=L[now].next[tmp]; if(next==-1)return; Late=Now ; now=Next; } Now=0; for(intI=0; i<len;i++){ inttmp=a[i]-'a'; intnext=L[now].next[tmp]; if(next==-1)return; Late=Now ; now=Next; L[now].s--; } l[now].init (); intTmp=a[len-1]-'a'; L[LATE].NEXT[TMP]= -1;}Chars1[ the];Chars2[ *];intN;intMain () {//FIN;l[0].init (); scanf ("%d", &N); while(N--) {scanf ("%s%s", S1, S2); if(s1[0] =='I'|| s1[0] =='I') Add (S2, strlen (S2)); Else if(s1[0] =='s'|| s1[0] =='S'){ BOOLv =query (S2, strlen (S2)); if(v) {printf ("yes\n"); } Else{printf ("no\n"); } } Else{Deletes (S2, strlen (S2)); } } return 0;}
http://acm.hdu.edu.cn/showproblem.php?pid=5688
#include <cstdio>#include<cstring>#include<map>#include<string>#include<algorithm>using namespacestd;#defineFIN freopen ("Input.txt", "R", stdin)intN;Chartstr[ ++5];map<string,int>TM;intMain () {//FIN;tm.clear (); scanf ("%d", &N); for(inti =0; i < N;i + +) {scanf ("%s", TSTR); Sort (tstr, Tstr+strlen (TSTR)); if(! tm[string(TSTR)]) tm[string(TSTR)] =0; printf ("%d\n", tm[string(TSTR)]); tm[string(TSTR)] ++; } return 0;}
2016 "Baidu Star"-Qualifying race (Astar Round1)