P1018-题解(C语言代码) #includeintmain(void){longlongpro=1;inti=0,j=0,n=0,k=0;charstr[16]={'\0',};scanf("%d%d",&n,&k);for(i=n;i>=1;--i){pro*=i;}while(0==pro%10){pro/=10;}for( 题解列表 2020年03月04日 0 点赞 0 评论 1518 浏览 评分:9.9
1285: 阶乘末尾的K位 ```cpp#include#includeusingnamespacestd;longlongjiecheng(intn){longlongsum=1;for(inti=1;i>n>>k;longlongsum=jiecheng(n);while(sum%10==0)sum/=10;longlong 题解列表 2023年04月15日 0 点赞 0 评论 606 浏览 评分:9.9
详细解释,阶乘末尾k位,小白写法,超容易懂! 首先,计算阶乘用数组模拟阶乘。详细解析可以看;https://blog.dotcpp.com/a/98223会了数组模拟阶乘计算后,就可以按照题目的意思编程啦!先附上注释版代码:```cpp#includeusingnamespacestd;constintN=1e4+10;intans[N+10]; 题解列表 2023年09月04日 0 点赞 0 评论 906 浏览 评分:9.9
1285: 阶乘末尾的K位 摘要:解题思路:最基础+细节注意事项:参考代码:#include<iostream>using namespace std;int getIntegerLength(int n) //求整数的长度妙法{ …… 题解列表 2024年03月09日 1 点赞 0 评论 512 浏览 评分:9.9
P1018 (C语言代码) 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int b[21],s[100];int n,k;int main(){ int i,j,t,flag; int w,r,q; scan…… 题解列表 2018年02月12日 0 点赞 0 评论 1621 浏览 评分:0.0
P1018 (C++代码) 摘要:#include <iostream> using namespace std; int main() { int k, n; long long sum = 1; cin >> n…… 题解列表 2018年03月31日 1 点赞 0 评论 1704 浏览 评分:0.0
P1018 (C语言代码) 解题思路:先求出阶乘,然后去掉后面的0,再把数字转换为字符串,然后再取后面的子串即可。注意事项:转换字符串时使用了sprintf函数,把数字转换为字符串,该函数有3个参数:第1个参数是要保存转换结果字符串的字符数组,第2个参数是输出格式,第3个参数是要转换的整数。 题解列表 2018年10月11日 0 点赞 0 评论 1874 浏览 评分:0.0
P1018 (C语言代码) 摘要:解题思路:注意事项:参考代码:#include<stdio.h> int main() { int a[100],cnt=0,n,m; long long sum=1; scanf("…… 题解列表 2019年05月05日 0 点赞 0 评论 1873 浏览 评分:0.0
P1018-题解(C++代码) 字符串的题目还是先分解题目首先需要求数字的阶乘用的函数就是longlong阶乘longlong类型是为了防止溢出然后我们需要去掉末尾0只需要判断能否被10整除就可以了然后循环/=10就可以去掉末尾0然后我们还需要求出位数如果位数resn>>k;longlongsum=jiechen(n);while( 题解列表 2019年08月30日 0 点赞 0 评论 1214 浏览 评分:0.0
阶乘末尾的K位 (Java代码) 摘要:import java.math.BigInteger; import java.util.Scanner; public class Main { public static vo…… 题解列表 2022年07月15日 0 点赞 0 评论 719 浏览 评分:0.0