题意:已知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的更多相关文章

  1. codeforces 868B The Eternal Immortality【暴力+trick】

    B. The Eternal Immortality time limit per test 1 second memory limit per test 256 megabytes input st ...

  2. Codeforces Round #439 (Div. 2) B. The Eternal Immortality

    B. The Eternal Immortality 题目链接http://codeforces.com/contest/869/problem/B 解题心得:题意就是给出a,b,问(a!)/(b!) ...

  3. 【Codeforces Round #439 (Div. 2) B】The Eternal Immortality

    [链接] 链接 [题意] 求b!/a!的最后一位数字 [题解] b-a>=20的话 a+1..b之间肯定有因子2和因子5 答案一定是0 否则暴力就好 [错的次数] 在这里输入错的次数 [反思] ...

  4. 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 ...

  5. CodeForces 869B

    Even if the world is full of counterfeits, I still regard it as wonderful. Pile up herbs and incense ...

  6. 【CF Round 439 B. The Eternal Immortality】

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  7. Codeforces Round #439 (Div. 2)【A、B、C、E】

    Codeforces Round #439 (Div. 2) codeforces 869 A. The Artful Expedient 看不透( #include<cstdio> in ...

  8. Codeforces Round #439 (Div. 2)

    A. The Artful Expedient 题目链接:http://codeforces.com/contest/869/problem/A 题目意思:给你两个数列,各包含n个数,现在让你从上下两 ...

  9. codeforces 869A/B/C

    A. The Artful Expedient time limit per test 1 second memory limit per test 256 megabytes input stand ...

随机推荐

  1. JS获取光标在input 或 texterea 中下标位置

    <textarea placeholder="请输入表达式" id="methodInput" ></textarea> 获取位置: v ...

  2. The property does not exist in XML namespace

    自定义依赖属性,绑定在xaml文件中,无问题. 但是编译失败,报 The property does not exist in XML namespace 错误. 发现如果依赖属性定义在本程序集中,在 ...

  3. How2J学习java-1、环境配置

    JDK环境变量配置分下载,配置,验证三个步骤. 一.首先需要到JDK下载网站下载所需的JDK版本可根据更新来定.主流的开发工具Idear下载. 1.首先看配置成功后的效果 点WIN键->运行(或 ...

  4. Mybatis之foreach用法----List、Array、Map三种类型遍历

    在mybatis的xml文件中构建动态sql语句时,经常会用到标签遍历查询条件.特此记录下不同情况下书写方式!-------仅供大家参考------ 1. foreach元素的属性 collectio ...

  5. ios 物流时间轴,自动匹配电话号码,可点击拨打

    http://www.code4app.com/thread-27587-1-1.html 资讯时间轴(折叠/展开) http://www.code4app.com/thread-32358-1-1. ...

  6. 吴裕雄 Bootstrap 前端框架开发——Bootstrap 排版:将所有列表项放置同一行

    <!DOCTYPE html> <html> <head> <title>菜鸟教程(runoob.com)</title> <meta ...

  7. linux 环境下安装jdk

    参考:https://blog.csdn.net/qq_30788949/article/details/81975954 安装 参考: https://www.cnblogs.com/shihaim ...

  8. 【PAT甲级】1025 PAT Ranking (25 分)(结构体排序,MAP<string,int>映射)

    题意: 输入一个正整数N(N<=100),表示接下来有N组数据.每组数据先输入一个正整数M(M<=300),表示有300名考生,接下来M行每行输入一个考生的ID和分数,ID由13位整数组成 ...

  9. 计划任务之一次性计划任务(at)和周期性计划任务(crontab)(重点)

    一:知识要点 ----计划任务的意义----计划任务分类----用户计划任务crontab----系统计划任务----计划任务使用注意事项----anacron服务介绍 二:计划任务的意义计划任务 - ...

  10. R语言 一个向量的值分派给另一个向量

    group = sample(seq(1,10),size = 20,replace = T) #这20个组分别属于1,...,10 v = rnorm(length(unique(group)),0 ...