B. The Eternal Immortality

题目链接http://codeforces.com/contest/869/problem/B

解题心得:题意就是给出a,b,问(a!)/(b!)的个位数,要注意0,5两个数,只要a,b相差超过5个位数就只能是0,其实没有看到相差5看到相差10也可以的,然后又暴力跑一个末位数就可以了。

/*这里跑的是相差10位*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll a,b;
scanf("%lld%lld",&a,&b);
if(b-a >= 10)
{
printf("0");
return 0;
} ll k = 1;
for(ll j=a+1;j<=b;j++)
{
ll z = j%10;
k *= z;
k %= 10;
}
printf("%lld",k); return 0;
}

Codeforces Round #439 (Div. 2) B. The Eternal Immortality的更多相关文章

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

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

  2. Codeforces Round #439 (Div. 2)

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

  3. Codeforces Round #439 (Div. 2) 题解

    题目链接  Round 439 div2 就做了两道题TAT 开场看C题就不会 然后想了好久才想到. 三种颜色挑出两种算方案数其实是独立的,于是就可以乘起来了. E题想了一会有了思路,然后YY出了一种 ...

  4. Codeforces Round #439 (Div. 2) A B C

    强哉qls,这场div2竟是其出的!!! A. The Artful Expedient 暴力 ^ ,判断是否出现,有大佬根据亦或的性质推出 Karen 必赢,太强啦23333333333333. # ...

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

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

  6. Codeforces Round #439 (Div. 2) Problem E (Codeforces 869E) - 暴力 - 随机化 - 二维树状数组 - 差分

    Adieu l'ami. Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around ...

  7. Codeforces Round #439 (Div. 2) Problem C (Codeforces 869C) - 组合数学

    — This is not playing but duty as allies of justice, Nii-chan! — Not allies but justice itself, Onii ...

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

  9. Codeforces Round #439 (Div. 2) Problem A (Codeforces 869A) - 暴力

    Rock... Paper! After Karen have found the deterministic winning (losing?) strategy for rock-paper-sc ...

随机推荐

  1. Codeforces Round #396 (Div. 2) A

    While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common s ...

  2. 15 使用lambdas和闭包

    1       使用lambdas和闭包 1.1  定义闭包 闭包是一个代码块,代替了方法或类. groovy中的闭包基于后边的构造方式:{list of parameters-> closur ...

  3. 转 如何诊断和解决high version count 10.2.0.4 and 11.2.0.4

    转自 http://blog.csdn.net/notbaron/article/details/50927492 在Oracle 10g以上的版本,High version count可谓是一个臭名 ...

  4. go实现生产者消费者

    package main import ( "fmt" "math/rand" ) func main() { ch := make(chan int) don ...

  5. 自动完成文本框(AutoCompleteTextView与MultiAutoCompleteTextView)关联适配器

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools=&q ...

  6. Javafinal方法

    class Animal{     public final void eat(){         System.out.println("吃");     } } class ...

  7. Linux远程连接及常用指令

    一.远程连接 一般,服务器都是特别庞大的,会把它们用一个独立的小屋进行存放,如果有时候需要对服务器进行一些操作,离得近还好,离的远就会破费一些周折了,所以,这个时候我们就需要用到远程连接软件了.推荐使 ...

  8. tomcat+nginx 横向扩展

    1.分别在电脑上部署两个tomcat tomcat1  tomcat2 2.不是nginx 并启动 输入 localhost 并进入nginx欢迎界面,证明部署成功 3.修改nginx 配置 ngin ...

  9. Fedora CentOS Red Hat中让vim支持语法高亮设置

    Fedora / CentOS / Red Hat这三个系统里默认的vi是没有语法高亮显示的,白色的字体看起来很不舒服. 首先用命令行cat /etc/os-release查看当前linux系统的类型 ...

  10. 使用Kubernetes里的job计算圆周率后2000位

    使用Kubernetes里的job(作业),我们可以很方便地执行一些比较耗时的操作. 新建一个job.ymal文件: 定义了一个Kubernetes job,名称为pi,类型为job,容器名称为pi, ...