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 ...
随机推荐
- php类的魔术方法也就是带下划线的类方法介绍及应用
001 PHP把所有以__(两个下划线)开头的类方法当成魔术方法,并且这些魔术方法的参数都不能通过引用传递.php的魔术方法有: 002 __construct(), __destruct(), _ ...
- java之中文乱码处理
有些时候,比如文件操作的时候,特别是文件中有中文,会规定用GBK格式,这时读写文件,可能会出现中文乱码 资源文件乱码 文件内容乱码 资源文件乱码: 解决: PropertiesUtil proper ...
- PSP第二次总结
项目计划总结: 姓名:李志强 日期:2017/12/06 听课 编程 阅读课本 准备考试 日总计 周日11.26 周一 100 100 周二 ...
- msbuild发布web应用程序
aspnet_compiler.exe 只能编译 网站,web应用程序项目使用下面的命令即可. msbuild C:\Jenkins\jobs\KM_ERP_WEBAPP\workspace\KMWe ...
- java finalize学习
1 finalize()调用的时机 与C++的析构函数(对象在清除之前析构函数会被调用)不同,在Java中,由于GC的自动回收机制,因而并不能保证finalize方法会被及时地执行(垃圾对象的回收时机 ...
- windows系统下hosts文件的改写(为了测试nginx内网的证书代理,需要做域名解析)
1. win加R C:\WINDOWS\system32\drivers\etc 2.打开hosts文件 加入一行 IP为客户机要访问的IP地址 域名也是在nginx中定义好的 3.ct ...
- 1012 The Best Rank (25分) vector与结构体排序
1012 The Best Rank (25分) To evaluate the performance of our first year CS majored students, we con ...
- USN日志
转载:https://www.iteye.com/blog/univasity-805234 https://blog.51cto.com/velika/1440105 源码:https://f ...
- 【PAT甲级】1010 Radix (25 分)(二分)
题意: 输入两个数可能包含小写字母,1或者2,进制大小.第三个数为代表第一个数是第四个数进制的,求第二个数等于第一个数时进制的大小,不可能则输出Impossible,第三个数为2代表第二个数是第四个数 ...
- CSP2019 括号树
Description: 给定括号树,每个节点都是 ( 或 ) ,定义节点的权值为根到该节点的简单路径所构成的括号序列中不同合法子串的个数(子串需要连续,子串所在的位置不同即为不同.)与节点编号的乘积 ...