codeforces 869BThe Eternal Immortality

来源:互联网 发布:怎么在淘宝上办学生证 编辑:程序博客网 时间:2024/05/16 06:03
/*阶乘求a!/b!的个位数字*/#include <cstdio>#include <algorithm>#include <cstring>using namespace std;typedef long long LL;LL a,b;int main(){    while(~scanf("%I64d%I64d",&a,&b))    {        LL ans=1;        for(LL i=a+1;i<=b;i++)        {            ans*=(i%10);            ans=ans%10;//取个位数字            if(ans==0) break;//0乘以任何数为0,剪枝        }        printf("%I64d\n",ans);    }    return 0;}
原创粉丝点击