• 2016"百度之星"


    http://acm.hdu.edu.cn/showproblem.php?pid=5685

    #include <cstdio>
    #include <cstring>
    #include <algorithm>
    using namespace std;
    const int MAXN = 1e5 + 5;
    int H[MAXN];
    char Hstr[MAXN];
    int N, l, r;
    const int mods = 9973;
    typedef long long LL;
    
    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;
        }
        return res;
    }
    
    
    int main(){
        while(~scanf("%d", &N)){
            scanf("%s", Hstr);
            int len = strlen(Hstr);
            H[0] = 1;
            for(int i = 1;i <= len;i ++){
                H[i] = H[i - 1] * (Hstr[i - 1] - 28) % mods;
            }
            while(N --){
                scanf("%d%d", &l, &r);
                if(l > r) swap(l, r);
                printf("%I64d
    ", (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
    ",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("
    ");
                for (i = a-1;i < b;i++)
                {
                    j = (str[i]-28) % 9973*j;
                }
                j = j % 9973;
                printf("%d
    ",j);
            }
            
        }
        return 0;
    }
    */

    http://acm.hdu.edu.cn/showproblem.php?pid=5686

    #include <iostream>
    #include <stdio.h>
    #include <string.h>
    using namespace std;
    int a[205][205];
    int main()
    {
        memset(a,0,sizeof(a));
        a[1][200]=1;a[2][200]=2;
        int i,j;
        for(i=3;i<=200;i++)
        {
            for(j=200;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]/10;
                    a[i][j]=a[i][j]%10;
                }
            }
        }
        int n;
        while(cin>>n)
        {
            j=0;
            while(a[n][j]==0)j++;
            for(;j<=200;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 namespace std;
    
    #define FIN freopen("input.txt","r", stdin)
    
    struct node{
        int next[27];
        int v,s;
        void init(){
            v=s=0;
            memset(next,-1,sizeof(next));
        }
    };
    struct node L[4000000];
    int tot=0;
    
    void add(char a[],int len){
        int now=0;
        for(int i=0;i<len;i++){
            int tmp=a[i]-'a';
            int next=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;
    }
    
    bool query(char a[],int len){
        int now=0;
        for(int i=0;i<len;i++){
            int tmp=a[i]-'a';
            int next=L[now].next[tmp];
            if(next==-1)return false;
            now=next;
        }
        return L[now].s > 0;
    }
    
    void deletes(char a[], int len){
        int now=0, late;
        for(int i=0;i<len;i++){
            int tmp=a[i]-'a';
            int next=L[now].next[tmp];
            if(next==-1) return;
            late = now;
            now=next;
        }
        now = 0;
        for(int i=0;i<len;i++){
            int tmp=a[i]-'a';
            int next=L[now].next[tmp];
            if(next==-1) return;
            late = now;
            now=next;
            L[now].s --;
        }
        L[now].init();
        int tmp=a[len - 1]-'a';
        L[late].next[tmp] = -1;
    }
    
    char S1[15];
    char S2[35];
    int N;
    int main(){
        //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'){
                bool v = query(S2, strlen(S2));
                if(v){
                    printf("Yes
    ");
                }
                else{
                    printf("No
    ");
                }
            }
            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 namespace std;
    #define FIN freopen("input.txt","r", stdin)
    int N;
    char tstr[40 + 5];
    map<string, int>TM;
    int main(){
        //FIN;
        TM.clear();
        scanf("%d", &N);
        for(int i = 0;i < N;i ++){
            scanf("%s", tstr);
            sort(tstr, tstr + strlen(tstr));
            if(!TM[string(tstr)]) TM[string(tstr)] = 0;
            printf("%d
    ", TM[string(tstr)]);
            TM[string(tstr)] ++;
        }
    
        return 0;
    }
  • 相关阅读:
    红线行动开发文档
    团队作业1
    第二次作业:安装VS2015和使用自动测试管理工具
    简单介绍VS2015自动测试工具
    软件工程作业(一)
    三带一队 实验十 团队作业6:团队项目用户验收&BETA冲刺
    《三带一队》【Beta】Scrum meeting 4
    《三带一队》【Beta】Scrum meeting 3
    《三带一队》【Beta】Scrum meeting 2
    《三带一队》【Beta】Scrum meeting 1
  • 原文地址:https://www.cnblogs.com/acmwangpeng/p/5538582.html
Copyright © 2020-2023  润新知