当前位置:网站首页>1005 spell it right (20 points) "PTA class a exercise"
1005 spell it right (20 points) "PTA class a exercise"
2022-07-02 20:32:00 【Yang tree Yang tree】
Pay attention to 0 In special circumstances
AC Code :
#include <cstring>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#define dd double
#define PII pair<int,int>
#define int long long
#define ll long long
using namespace std;
const dd eps = 1e-6;
const int mod = 998244353;
const int N = 1e5+10;
string a;
char b[N];
int tot;
signed main()
{
cin>>a;
int ans = 0;
int len = a.length();
for(int i=0;i<len;i++)
{
ans += a[i] - '0';
}
while(ans!=0)
{
int m = ans % 10;
b[++tot]='0'+m;
ans /= 10;
}
int ddd=1;
for(int i=tot;i>=1;i--)
{
if(b[i]=='0') printf("zero");
if(b[i]=='1') printf("one");
if(b[i]=='2') printf("two");
if(b[i]=='3') printf("three");
if(b[i]=='4') printf("four");
if(b[i]=='5') printf("five");
if(b[i]=='6') printf("six");
if(b[i]=='7') printf("seven");
if(b[i]=='8') printf("eight");
if(b[i]=='9') printf("nine");
if(i!=1) printf(" ");
ddd=0;
}
if(a[0]=='0'&&ddd==1) printf("zero");
return 0;
}
边栏推荐
- Motivation! Big Liangshan boy a remporté le prix Zhibo! Un article de remerciement pour les internautes qui pleurent
- Research Report on the overall scale, major manufacturers, major regions, products and applications of metal oxide arresters in the global market in 2022
- Cron expression (seven subexpressions)
- Activation function - relu vs sigmoid
- Automated video production
- JS how to get integer
- Attack and defense world PWN question: Echo
- How my mother-in-law and daughter-in-law get along
- 【Hot100】22. bracket-generating
- What are the benefits of multi terminal applet development? Covering Baidu applet, Tiktok applet, wechat applet development, and seizing the multi platform traffic dividend
猜你喜欢
[cloud native topic -50]:kubesphere cloud Governance - operation - step by step deployment of microservice based business applications - database middleware MySQL microservice deployment process
【QT】QPushButton创建
pytorch 模型保存的完整例子+pytorch 模型保存只保存可训练参数吗?是(+解决方案)
Basic concept of database, installation and configuration of database, basic use of MySQL, operation of database in the project
[source code analysis] model parallel distributed training Megatron (5) -- pipestream flush
Highly qualified SQL writing: compare lines. Don't ask why. Asking is highly qualified..
Spark source code compilation, cluster deployment and SBT development environment integration in idea
How to do interface testing? After reading this article, it will be clear
「 工业缺陷检测深度学习方法」最新2022研究综述
After eight years of test experience and interview with 28K company, hematemesis sorted out high-frequency interview questions and answers
随机推荐
C language linked list -- to be added
[871. Minimum refueling times]
AcWing 1135. Happy New Year (shortest path + search)
for(auto a : b)和for(auto &a : b)用法
[fluent] dart function (function composition | private function | anonymous function | function summary)
Want to ask, is there any discount for opening an account now? Is it safe to open an account online?
Basic concept of database, installation and configuration of database, basic use of MySQL, operation of database in the project
【QT】QPushButton创建
Spark source code compilation, cluster deployment and SBT development environment integration in idea
Second hand housing data analysis and prediction system
[JS] get the search parameters of URL in hash mode
Use graalvm native image to quickly expose jar code as a native shared library
【Hot100】22. bracket-generating
CRM Customer Relationship Management System
【Hot100】23. 合并K个升序链表
在网上炒股开户安全吗?我是新手,还请指导
【JS】获取hash模式下URL的搜索参数
Research Report on the overall scale, major manufacturers, major regions, products and applications of capacitive voltage transformers in the global market in 2022
Conscience summary! Jupyter notebook from Xiaobai to master, the nanny tutorial is coming!
数据库模式笔记 --- 如何在开发中选择合适的数据库+关系型数据库是谁发明的?