当前位置:网站首页>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;
}
边栏推荐
猜你喜欢
MATLAB中如何把cftool拟合的函数输出到命令行(解决如何导出拟合后的曲线数据)
PTA习题 分类统计字符个数(C)
fork creates multiple child processes
信号量SIGCHLD的使用,如何让父进程得知子进程执行结束,如何让父进程区分多个子进程的结束
x86 Exception Handling and Interrupt Mechanism (1) Overview of the source and handling of interrupts
数论知识点
激光条纹中心提取——灰度重心法
x86异常处理与中断机制(3)中断处理过程
Number theory knowledge
CentOS6.5 32bit安装Oracle、ArcSde、Apache等配置说明
随机推荐
基于STM32F103移植FreeRTOS
Arduino学习总结 + 实习项目
mysql参数配置学习----临时表内存表的设置
链表基本操作(详解)
grpc系列-初探grpc 路由注册和转发实现
1005 Spell It Right (20分)
Oracle Database Architecture
End-to-End Object Detection with Fully Convolutional Network学习笔记
百钱买鸡(一)
∘(空心的点乘)的数学含义
Antdv+Asp.net WebApi开发学生信息管理系统(一)
wpf实现简易画板功能(带截取画板,签名截图等等)
Tensorflow realize parameter adjustment of linear equations
CAN总线发送数据
gdb tui的使用
Quartz分布式实现
Julia常见符号意思
golang源代码阅读,sync系列-Pool
PTA 矩阵运算
学长告诉我,大厂MySQL都是通过SSH连接的