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 }
  • 相关阅读:
    /etc/init.d/functions详解[转]
    把linux可执行程序做成一个服务[转]
    Centos下Subversion 服务器安装配置(转)
    经典面试编程题atoi()实现
    asp.net mvc 模型绑定 从简单类型到泛型集合
    C# 编译器 csc 简单用法
    js 操作文本框中光标位置
    简洁的lambda表达式
    iphone safari不支持position fixed的解决办法
    List排序函数Sort
  • 原文地址:https://www.cnblogs.com/invisible/p/2400457.html
Copyright © 2011-2022 走看看