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

    C++语言: Codee#25824
    01 /*
    02 +++++++++++++++++++++++++++++++++++++++
    03                 author: chm
    04 +++++++++++++++++++++++++++++++++++++++
    05 */
    06
    07 #include <map>
    08 #include <set>
    09 #include <list>
    10 #include <queue>
    11 #include <cmath>
    12 #include <stack>
    13 #include <bitset>
    14 #include <cstdio>
    15 #include <cctype>
    16 #include <string>
    17 #include <vector>
    18 #include <cassert>
    19 #include <cstdlib>
    20 #include <cstring>
    21 #include <fstream>
    22 #include <sstream>
    23 #include <iomanip>
    24 #include <iostream>
    25 #include <algorithm>
    26
    27 using namespace std;
    28
    29 FILE*            fin         = stdin;
    30 FILE*            fout         = stdout;
    31 const int        max_size     = 10086;
    32 char vowel[] = "AUEOI";
    33 char cons[] = "JSBKTCLDMVNWFXGPYHQZR";
    34 char ans1[max_size];
    35 char ans2[max_size];
    36
    37 int main()
    38 {
    39 #ifndef ONLINE_JUDGE
    40     freopen("c:\\in.txt", "r", stdin);
    41     fout = fopen("c:\\garage\\out.txt", "w");
    42 #endif
    43     int n;
    44     scanf("%d", &n);
    45     for(int i = 0; i < n; ++i)
    46     {
    47         int len;
    48         scanf("%d", &len);
    49         fprintf(fout, "Case %d: ", i + 1);
    50
    51         int odd = 0;
    52         int even = 0;
    53         for(int j = 0; j < len; ++j)
    54             if(j % 2)                // aj.aja  even
    55                 ans1[even] = cons[even++ / 5];
    56             else
    57                 ans2[odd] = vowel[odd++ / 21];
    58         sort(ans1, ans1 + even);                //sort,keep vowel in odd index
    59         sort(ans2, ans2 + odd);
    60         for(int j = 0; j < len; ++j)
    61             if(j % 2)
    62                 fprintf(fout, "%c", ans1[j / 2]);
    63             else
    64                 fprintf(fout, "%c", ans2[j / 2]);
    65         fprintf(fout, "\n");
    66     }
    67
    68
    69 #ifndef ONLINE_JUDGE
    70     fclose(fout);
    71     system("c:\\garage\\check.exe");
    72     system("notepad c:\\garage\\out.txt");
    73 #endif
    74     return 0;
    75 }
    76 /*
    77 Sample Input
    78
    79 3
    80 1
    81 5
    82 5
    83 Sample Output
    84
    85 Case 1: A
    86 Case 2: AJAJA
    87 Case 3: AJAJA
    88
    89 */
  • 相关阅读:
    javaWeb接口开发
    .NET设计模式(4):建造者模式(Builder Pattern)(转载)
    .net数据库连接池(转载)
    系统操作日志设计(转载)
    系统操作日志设计-代码实现(转载)
    GOF对Builder模式的定义(转载)
    Javascript中的对象和原型(一)(转载)
    Javascript中的对象和原型(二)(转载)
    Javascript中的对象和原型(三)(转载)
    服务器安全设置(转载)
  • 原文地址:https://www.cnblogs.com/invisible/p/2397478.html
Copyright © 2011-2022 走看看