当前位置:网站首页>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;
}
边栏推荐
猜你喜欢
随机推荐
日期工具类
1008 Elevator (20分)
七夕?程序员不存在的~
激光条纹中心提取——灰度重心法
Quartz的理解
Qt 国际化翻译
golang 三种指针类型具体类型的指针、unsafe.Pointer、uintptr作用
Missing URI template variable ‘employeeNumber‘ for method parameter of type String
ACM最长不下降子序列问题
CentOS6.5 32bit安装Oracle-11gR2步骤说明
杂记(6)
【精华文】C语言结构体特殊情况分析:结构体指针 / 基本数据类型指针,指向其他结构体
Quartz分布式实现
Qt读写.ini配置文件
OpenSSF's open source software risk assessment tool: Scorecards
【VIBE: Video Inference for Human Body Pose and Shape Estimation】论文阅读
Looper 原理浅析
在线编译matlab,亲测好用
1006 Sign In and Sign Out (25分)
信号量SIGCHLD的使用,如何让父进程得知子进程执行结束,如何让父进程区分多个子进程的结束