zoukankan      html  css  js  c++  java
  • 1005. Spell It Right

    C++语言: Codee#25844
    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 const char* name[]=
    33 {
    34     "zero",
    35     "one",
    36     "two",
    37     "three",
    38     "four",
    39     "five",
    40     "six",
    41     "seven",
    42     "eight",
    43     "nine"
    44 };
    45
    46 #define ONLINE_JUDGE
    47 int main()
    48 {
    49 #ifndef ONLINE_JUDGE
    50     freopen("d:\\in.txt", "r", stdin);
    51     freopen("d:\\out.txt", "w", stdout);
    52 #endif
    53     char str[max_size];
    54     char tostr[max_size];
    55     while(scanf("%s",str)!=EOF)
    56     {
    57         int ans=0;
    58         for(int i=0,len=strlen(str);i<len;++i)
    59             ans+=str[i]-'0';
    60         sprintf(tostr,"%d",ans);
    61         for(int j=0,k=strlen(tostr);j<k;++j)
    62             printf("%s%s",name[tostr[j]-'0'],j==k-1?"\n":" ");
    63     }
    64
    65 #ifndef ONLINE_JUDGE
    66     fclose(stdout);
    67     system("start d:\\check.exe d:\\out.txt d:\\ans.txt");
    68 #endif
    69     return 0;
    70 }
  • 相关阅读:
    hdu 1535 Invitation Cards(spfa)
    hdu 1317 XYZZY
    hdu 1245 Saving James Bond
    hdu 1546 Idiomatic Phrases Game
    hdu 1217 Arbitrage(佛洛依德)
    hdu 1599 find the mincost route(无向图的最小环)
    poj1579
    poj1905
    poj1384
    poj3624
  • 原文地址:https://www.cnblogs.com/invisible/p/2400457.html
Copyright © 2011-2022 走看看