Codeforces Round #439 (Div. 2)
来源:互联网 发布:java json双引号转义 编辑:程序博客网 时间:2024/06/05 01:39
题意:
求一个阶乘除以阶乘的个位数。
POINT:
这种题肯定不是暴力去做。一开始想找循环节,仔细一想还是很慢。
只要乘以了末尾有0的数,那么答案肯定是0,其他就一个for循环,顶多循环9次。
#include <iostream>#include <string.h>#include <stdio.h>#include <math.h>#include<algorithm>using namespace std;#define LL long longconst int maxn = 2222;int main(){ LL ans=1; LL a,b; scanf("%lld %lld",&a,&b); for(LL i=a+1;i<=b;i++){ if(i%10==0){ ans=0; break; } else{ ans=ans*i%10; } } printf("%lld\n",ans);}
阅读全文
0 0
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div.2)
- Codeforces Round #439 (Div.2)
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div. 2)
- Codeforces Round #439 (Div. 2) C
- Codeforces Round #439 (Div. 2) 题解
- Codeforces Round #439 (Div. 2) 总结
- Codeforces Round #439 (Div. 2)A,B
- Codeforces Round #439 (Div. 2)E详解
- Codeforces Round #102 (Div. 2)
- Codeforces Round #103 (Div. 2)
- Codeforces Round #103 (Div. 2)
- Codeforces Round #104 (Div. 2)
- Codeforces Round #105 (Div. 2)
- Codeforces Round #105 (Div. 2)
- 浅谈HTTP中Get与Post的区别
- Pandas数据规整
- thymeleaf框架通过java渲染html生成pdf
- Longest Increasing Path in a Matrix
- coreutils源码学习之——mkdir.c
- Codeforces Round #439 (Div. 2)
- 关于thinkphp5.0 rc4.0扩展类库自动与手动加载的问题
- 数据库事务的复习笔记
- Java正则表达式与IO流简单练习
- 不要只怀揣梦想,而是要努力实现梦想!
- 690-Employee Importance
- 剑指Offer编程练习__重建二叉树
- 用户及组的相关命令操作
- SpringMVC学习系列(11) 之 表单标签