CodeForces - 869B The Eternal Immortality
题意:已知a,b,求
的最后一位。
分析:
1、若b-a>=5,则尾数一定为0,因为连续5个数的尾数要么同时包括一个5和一个偶数,要么包括一个0。
2、若b-a<5,直接暴力求即可。
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<iostream>
#include<sstream>
#include<iterator>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<deque>
#include<queue>
#include<list>
#define lowbit(x) (x & (-x))
const double eps = 1e-8;
inline int dcmp(double a, double b){
if(fabs(a - b) < eps) return 0;
return a > b ? 1 : -1;
}
typedef long long LL;
typedef unsigned long long ULL;
const int INT_INF = 0x3f3f3f3f;
const int INT_M_INF = 0x7f7f7f7f;
const LL LL_INF = 0x3f3f3f3f3f3f3f3f;
const LL LL_M_INF = 0x7f7f7f7f7f7f7f7f;
const int dr[] = {0, 0, -1, 1, -1, -1, 1, 1};
const int dc[] = {-1, 1, 0, 0, -1, 1, -1, 1};
const int MOD = 1e9 + 7;
const double pi = acos(-1.0);
const int MAXN = 2000 + 10;
const int MAXT = 10000 + 10;
using namespace std;
int main(){
LL a, b;
scanf("%lld%lld", &a, &b);
if(b - a >= 5){
printf("0\n");
}
else{
LL ans = 1;
for(LL i = a + 1; i <= b; ++i){
(ans *= (i % 10)) %= 10;
}
printf("%lld\n", ans);
}
return 0;
}
CodeForces - 869B The Eternal Immortality的更多相关文章
- codeforces 868B The Eternal Immortality【暴力+trick】
B. The Eternal Immortality time limit per test 1 second memory limit per test 256 megabytes input st ...
- Codeforces Round #439 (Div. 2) B. The Eternal Immortality
B. The Eternal Immortality 题目链接http://codeforces.com/contest/869/problem/B 解题心得:题意就是给出a,b,问(a!)/(b!) ...
- 【Codeforces Round #439 (Div. 2) B】The Eternal Immortality
[链接] 链接 [题意] 求b!/a!的最后一位数字 [题解] b-a>=20的话 a+1..b之间肯定有因子2和因子5 答案一定是0 否则暴力就好 [错的次数] 在这里输入错的次数 [反思] ...
- Codeforces Round #439 (Div. 2) Problem B (Codeforces 869B)
Even if the world is full of counterfeits, I still regard it as wonderful. Pile up herbs and incense ...
- CodeForces 869B
Even if the world is full of counterfeits, I still regard it as wonderful. Pile up herbs and incense ...
- 【CF Round 439 B. The Eternal Immortality】
time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...
- Codeforces Round #439 (Div. 2)【A、B、C、E】
Codeforces Round #439 (Div. 2) codeforces 869 A. The Artful Expedient 看不透( #include<cstdio> in ...
- Codeforces Round #439 (Div. 2)
A. The Artful Expedient 题目链接:http://codeforces.com/contest/869/problem/A 题目意思:给你两个数列,各包含n个数,现在让你从上下两 ...
- codeforces 869A/B/C
A. The Artful Expedient time limit per test 1 second memory limit per test 256 megabytes input stand ...
随机推荐
- print、println、printf的区别(转载)
printf主要是继承了C语言的printf的一些特性,可以进行格式化输出 print就是一般的标准输出,但是不换行 println和print基本没什么差别,就是最后会换行 System ...
- Shell函数!
1.作用:将命令序列按格式写在一起,可方便重复使用命令序列2.Shell 函数定义格式:[ function ] 函数名(){命令序列[ return x ]}3.调用函数的方法:函数名 [ 参数 1 ...
- java中关于&0xFF 的问题
最近遇到一个问题,半天也没想明白,byte temp = 0xA0,为什么System.out.println(temp),打印的值为:-96:而System.out.println(temp& ...
- 理解WPF中的视觉树和逻辑树
轉載地址:http://blog.csdn.net/changtianshuiyue/article/details/26981797 理解WPF中的视觉树和逻辑树 Understanding th ...
- SpringBoot 集成Log4j、集成AOP
集成Log4j (1)在pom.xml中添加依赖 <!--去掉springboot默认的日志--> <dependency> <groupId>org.spring ...
- MySQL - 设置UTF-8编码
1. 在Windows上,安装时请选择UTF-8编码,以便正确地处理中文. 在Mac或Linux上,需要编辑MySQL的配置文件,把数据库默认的编码全部改为UTF-8.MySQL的配置文件默认存放在/ ...
- 如何查看NXP产品的供货计划?
大的半导体厂商一般会提供每个产品的生命周期计划,NXP的工业级IC一般供货10年,汽车级是15年,具体的时间可以在官网查询得到. 首先,打开NXP官网链接 产品长期供货计划,可以看到以下页面 接着,筛 ...
- gitlab相关命令操作
[root@xuegod63 ~]# git config --global user.name "zsl3"[root@xuegod63 ~]# git config --glo ...
- select模块
select模块 1. select模块 源:select.py This module provides access to the select() and poll() functio ...
- leetcode刷题-- 2. 排序(待更新)
排序 参考五分钟学算法 复杂度比较 时间复杂度 O(n2) 各种简单的排序:直接插入.直接选择.冒泡 O(nlog2n) 快速排序.堆排序.归并排序 O(n1+\(\lambda\)),希尔排序 线性 ...