当前位置:网站首页>PAT1005
PAT1005
2022-08-09 11:09:00 【AlanLiu6】
c和c++的函数、语法都忘光了,好惨
https://pintia.cn/problem-sets/994805342720868352/problems/994805519074574336
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
char num[1005];
string str[10] = {"zero","one","two","three","four","five","six","seven","eight","nine"};
char s[105];
int main()
{
//scanf("%s",num);
int sum = 0;
while(1)
{
char c;
scanf("%c",&c);
if(c == '\n' || c == ' ') break;
sum += c - '0';
}
//printf("%d",sum);
sprintf(s,"%d",sum);
// printf("%s",s);
int t = s[0]-'0';
cout << str[t];
for(int i = 1;i < strlen(s);i++)
{
t = s[i]-'0';
cout << " " << str[t];
}
printf("\n");
return 0;
}
边栏推荐
- PTA 计算天数
- 【Subpixel Dense Refinement Network for Skeletonization】CVPR2020论文解读
- 1003 Emergency (25分)
- 爱可可AI前沿推介(8.9)
- bit、byte、KB、M、G、T相互关系
- Preparation for gold three silver four: how to successfully get an Ali offer (experience + interview questions + how to prepare)
- ECCV 2022 Oral | CCPL: 一种通用的关联性保留损失函数实现通用风格迁移
- Netscope: Online visualization tool for neural network structures
- es6对象迭代器iterator
- 依赖注入(Dependency Injection)框架是如何实现的
猜你喜欢
随机推荐
wait系统调用
STemwin中GUI_Exec和GUI_Delay
美的数字化平台 iBUILDING 背后的技术选型
无刷无霍尔BLCD电机控制
mysql参数配置学习----临时表内存表的设置
c语言函数的递归调用(汉诺塔问题,楼梯递归问题等)
结构体知识点整合(前篇)
使用.NET简单实现一个Redis的高性能克隆版(四、五)
es6对象迭代器iterator
MySQL传统方案和通过SSH连接哪个好?
Antdv+Asp.net WebApi开发学生信息管理系统(一)
Installation of gdb 10.2
wpf path xaml写法和c#写法对比
sublime记录
margin出bug---margin失效
OC-块对象
【VIBE: Video Inference for Human Body Pose and Shape Estimation】论文阅读
x86 Exception Handling and Interrupt Mechanism (1) Overview of the source and handling of interrupts
OC-NSTimer
七夕?程序员不存在的~