zoukankan      html  css  js  c++  java
  • uva10785 The Mad Numerologist

    AC代码,这不是我自己写出来的,而是仿出来的,因为我不看别人的代码,我实在是猜不出这个题目的意思 是什么,完全不懂那些乱七八糟的英文。猜题太难了!!!举步维艰

    不过,这个题目理解出来之后,代码实在是太简单了,没什么算法在里面

    View Code
    #include<stdio.h>
    #include<stdlib.h>
    #include<string.h>
    char yuan[] = "AUEOI", fu[] = "JSBKTCLDMVNWFXGPYHQZR";
    int cmp(const void *a,const void *b)
    {
        return *(char *)a-*(char *)b;
    }
    int main()
    {
        char st1[126], st2[126];
        int m, n, j;
        while(~scanf("%d",&m))
        {
            for(j = 0;j < m; j++)
            {
            scanf("%d",&n);
            int i;
            for(i = 0;i < n-n/2; i++)
                st1[i] = yuan[i/21];
            for(i = 0;i < n/2; i++)
                st2[i] = fu[i/5];
            qsort(st1,n-n/2,sizeof(st1[0]),cmp);
            qsort(st2,n/2,sizeof(st2[0]),cmp);
            printf("Case %d: ",j+1);
            int t, r;
            for(i = r = t = 0;i < n; i++)
            {
                if(i%2 == 1)
                    printf("%c",st2[t++]);
                else
                    printf("%c",st1[r++]);
            }
            printf("\n");
            }
        }
        return 0;
    }
  • 相关阅读:
    bzoj 1054
    bzoj 1047
    bzoj 2761
    bzoj 1191
    bzoj 2748
    bzoj_1003 物流运输
    新的开始( [USACO08OCT]打井Watering Hole)
    map
    Generic Cow Protests-G——60分做法
    逆序对
  • 原文地址:https://www.cnblogs.com/SDUTYST/p/2597654.html
Copyright © 2011-2022 走看看