字符数组解Tom数 摘要:解题思路:因为int范围最高到2的31次方-1,所以改为数组注意事项:参考代码: char str[100]; while(~scanf("%s",str)) { int l,su…… 题解列表 2023年12月12日 0 点赞 0 评论 453 浏览 评分:0.0
我看了很多题解,就是感觉为啥他们都写得那么复杂 摘要:解题思路:注意事项:直接定义int可能不够用·参考代码:#include<stdio.h>int main(){ long n,sum=0; while (scanf("%ld", &n) !=EOF…… 题解列表 2023年12月02日 0 点赞 0 评论 653 浏览 评分:0.0
c代码记录之TOM数(atoi函数用于字符串转数字,单个字符不行) 代码1:用atoi函数#include#includeintmain(){charstr[20],num[2];//因为atoi不能转单个字符,故建议一个数组来盛放单个字符,使其成串intsum=0,n,i,m;while(~scanf("%s", 题解列表 2023年12月01日 0 点赞 0 评论 453 浏览 评分:0.0
Tom数(c语言) 摘要:注意事项: 定义的范围要大些 参考代码: ```c #include #include int main() { unsigned int a; while(scanf("%u"…… 题解列表 2023年08月30日 0 点赞 0 评论 525 浏览 评分:0.0
最简单易懂的解法 摘要:解题思路:while循环每次输入一行数字,内嵌套while循环每个位数求和,并输出注意事项:参考代码:#include<stdio.h>int main(){ long a; while(~s…… 题解列表 2023年04月08日 0 点赞 0 评论 434 浏览 评分:0.0
记录一下TOM数这道题的题解 摘要:用字符串的话这道题还蛮简单的,就是第一次2的32次方的位数判断错了,没跑出来参考代码:#include<stdio.h>int Sum(char* ps){ int sum=0; whil…… 题解列表 2023年02月10日 0 点赞 0 评论 494 浏览 评分:0.0
Tom数(c语言) 摘要:解题思路:注意事项:参考代码:#include<stdio.h>#include<string.h>int main(){ int i,s; char a[100]; while(…… 题解列表 2023年01月28日 0 点赞 0 评论 760 浏览 评分:0.0
Tom数(水题) 摘要:```c #include int main(){ long long n,sum,i; while(scanf("%lld",&n)!=EOF){ sum=0; …… 题解列表 2023年01月24日 0 点赞 0 评论 484 浏览 评分:0.0
1118 :tom数 要用Long long 类型去接收 摘要:解题思路:注意事项:参考代码:#include<stdio.h> int func(long long x); int main() { long long a; long lon…… 题解列表 2022年12月18日 0 点赞 0 评论 486 浏览 评分:0.0
编写题解 1118: Tom数 (C语言) 摘要:解题思路:就知道你不喜欢看解释注意事项:参考代码://每行一个输出,对应该数的各位数之和. #include <stdio.h> #include <string.h> int main (vo…… 题解列表 2022年12月17日 0 点赞 0 评论 994 浏览 评分:9.9