CF68A Irrational problem

    • 324通过
    • 511提交
  • 题目来源 CodeForces 68A
  • 评测方式 RemoteJudge
  • 标签 字符串 枚举,暴力
  • 难度 入门难度
  • 时空限制 2000ms / 256MB

题解

  • 提示:收藏到任务计划后,可在首页查看。
  • 最新讨论 显示

    推荐的相关题目 显示

    题意翻译

    输入p1、p2、p3、p4,输入a和b,求在[a,b]这个区间内有多少个数%p1、%p2、%p3、%p4后还是它本身

    Translated by @夜刀神十香ღ

    题目描述

    Little Petya was given this problem for homework:

    You are given function (here represents the operation of taking the remainder). His task is to count the number of integers $ x $ in range $ [a;b] $ with property $ f(x)=x $ .

    It is a pity that Petya forgot the order in which the remainders should be taken and wrote down only 4 numbers. Each of 24 possible orders of taking the remainder has equal probability of being chosen. For example, if Petya has numbers 1, 2, 3, 4 then he can take remainders in that order or first take remainder modulo 4, then modulo 2, 3, 1. There also are 22 other permutations of these numbers that represent orders in which remainder can be taken. In this problem 4 numbers wrote down by Petya will be pairwise distinct.

    Now it is impossible for Petya to complete the task given by teacher but just for fun he decided to find the number of integers with property that probability that $ f(x)=x $ is not less than $ 31.4159265352718281828459045% $ . In other words, Petya will pick up the number $ x $ if there exist at least $ 7 $ permutations of numbers $ p_{1},p_{2},p_{3},p_{4} $ , for which $ f(x)=x $ .

    输入输出格式

    输入格式:

    First line of the input will contain 6 integers, separated by spaces: $ p_{1},p_{2},p_{3},p_{4},a,b $ ( $ 1<=p_{1},p_{2},p_{3},p_{4}<=1000,0<=a<=b<=31415 $ ).

    It is guaranteed that numbers $ p_{1},p_{2},p_{3},p_{4} $ will be pairwise distinct.

    输出格式:

    Output the number of integers in the given range that have the given property.

    输入输出样例

    输入样例#1: 复制
    2 7 1 8 2 8
    
    输出样例#1: 复制
    0
    
    输入样例#2: 复制
    20 30 40 50 0 100
    
    输出样例#2: 复制
    20
    
    输入样例#3: 复制
    31 41 59 26 17 43
    
    输出样例#3: 复制
    9
    
    提示
    标程仅供做题后或实在无思路时参考。
    请自觉、自律地使用该功能并请对自己的学习负责。
    如果发现恶意抄袭标程,将按照I类违反进行处理。