题意:

给出一个非零整数N(<=10^100),计算每位之和并用英文输出。

AAAAAccepted code:

 #include<bits/stdc++.h>
using namespace std;
string s;
char num[][]={"zero","one","two","three","four","five","six","seven","eight","nine"};
int main(){
cin>>s;
int ans=;
for(int i=;i<s.length();++i)
ans+=s[i]-'';
int x=ans/;
ans%=;
int y=ans/;
ans%=;
int z=ans;
if(x)
cout<<num[x]<<" "<<num[y]<<" "<<num[z];
else if(y)
cout<<num[y]<<" "<<num[z];
else
cout<<num[z];
return ;
}

【PAT甲级】1005 Spell It Right (20 分)的更多相关文章

  1. PAT 甲级 1005 Spell It Right (20)(代码)

    1005 Spell It Right (20)(20 分) Given a non-negative integer N, your task is to compute the sum of al ...

  2. PAT 甲级 1005. Spell It Right (20) 【字符串】

    题目链接 https://www.patest.cn/contests/pat-a-practise/1005 思路 因为 n <= 10^100 所以 要用字符串读入 但是 100 * 100 ...

  3. Day 006:PAT练习--1005 Spell It Right (20 分)

    上星期一直在写报告乱七八糟的,从今天开始不刷乙级的了,还是多刷甲级进步来得快一点! 显而易见,该题的关键在于将输入之和的每一位从高到低输出,这里我们发现题意中的输入数的范围为0-10^100,显然我们 ...

  4. PAT Advanced 1005 Spell It Right (20 分)

    Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output e ...

  5. PAT (Advanced Level) Practice 1005 Spell It Right (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1005 Spell It Right (20 分) 凌宸1642 题目描述: Given a non-negative integer N ...

  6. 1005 Spell It Right (20分)

    1005 Spell It Right (20分) 题目: Given a non-negative integer N, your task is to compute the sum of all ...

  7. PAT甲级:1152 Google Recruitment (20分)

    PAT甲级:1152 Google Recruitment (20分) 题干 In July 2004, Google posted on a giant billboard along Highwa ...

  8. PAT 甲 1005. Spell It Right (20) 2016-09-09 22:53 42人阅读 评论(0) 收藏

    1005. Spell It Right (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given ...

  9. PAT 甲级 1005 Spell It Right (20 分)

    1005 Spell It Right (20 分) Given a non-negative integer N, your task is to compute the sum of all th ...

  10. PAT 甲级 1041 Be Unique (20 分)

    1041 Be Unique (20 分) Being unique is so important to people on Mars that even their lottery is desi ...

随机推荐

  1. ARM架构安装Anaconda3出现错误:cannot execute binary file: Exec format error

    ARM架构安装Anaconda3出现错误:cannot execute binary file: Exec format error 原因是:安装包格式不对. 在Anaconda官网上只有x86(32 ...

  2. Python连载59-HTTP首部字段和消息头,Thinker简介

    一.首部字段或者消息头 1.下面几个类型都是请求的: User-Agent:关于浏览器和它平台的消息,如Mozilla5.0 Accept:客户端能处理的页面的类型,如text/html Accept ...

  3. Plastic Bottle Manufacturer: Characteristic Analysis Of Plastic Packaging Bottles

    Plastic packaging bottles are usually made of 7 materials. Due to its inherent characteristics, the ...

  4. python中的基本类型

    字符串类型 字符串相当于羊肉串,而字符串就是一串被串起来的字符,在单引号.双引号或三引号内包裹一串字符.需要注意的是:三引号内的字符串可以换行,而单引号内的字符不行 name='anny' name= ...

  5. Codeforces Round #622 (Div. 2) C1. Skyscrapers (easy version)(简单版本暴力)

    This is an easier version of the problem. In this version n≤1000n≤1000 The outskirts of the capital ...

  6. 【C语言】创建一个函数,并调用比较两个数的大小

    #include <stdio.h> int max(int x,int y) { if(x>=y) return x; else return y; } main() { int ...

  7. 使用axios对安卓或者ios低版本兼容性处理

    原因:不支持ES6,无法使用promise 解决办法: 1.安装 es6-promise cnpm install es6-promise --save-dev 2.引入 es6-promise im ...

  8. unittest如何制作测试套件Testsuite 按method,class ,module,按命令行执行unittest

    cmd 执行unittest case : python -m unitest test.py  test2.py python -m unittest  testfile.testclass.tes ...

  9. vscode 提示 Running save participants 无法保存文件

    今天vscode提示一直在running save participants...中,无法保存文件 control + shift + p打开面板后,输入Reload with extensions ...

  10. 「JSOI2013」游戏中的学问

    「JSOI2013」游戏中的学问 传送门 考虑 \(\text{DP}\) 设 \(dp_{i, j}\) 表示将前 \(i\) 个人分成 \(j\) 个集合,并且第 \(i\) 个人在第 \(j\) ...