zoukankan      html  css  js  c++  java
  • SPOJ:Easy Factorials(占位)

    Finding factorials are easy but they become large quickly that is why Lucky hate factorials. Today he have another task related to factorials.

    For a given number n how many ways factorial n can expressed as a sum of two or more consecutive positive integers. Can you help lucky ?

    Input

    First line contains single integer T < 5001, next T lines followed by an integer N<10^8 and M<10^9.

    where M is a prime number.

    Output

    Print the desired result mod M.

    Example

    Input:
    1
    3 7
    
    Output:
    1

    Explanation:: 3! = 1+2+3 only one way.

    Speed Adicts My best time for all cases is 1.57s. Best of Luck have fun:) .

    题意:给定N,问N的阶乘可以表示为一段连续数字之和的方案数,答案模M。

    思路:无。

  • 相关阅读:
    windows nginx
    stdClass 标准
    array_merge
    array_pop
    array_push
    array_unique
    GMT与UTC简介(转)
    curl-手册
    13.5. zipfile — Work with ZIP archives
    7. Input and Output
  • 原文地址:https://www.cnblogs.com/hua-dong/p/9049557.html
Copyright © 2011-2022 走看看