• HDU 多校1.4


    Division Game

    Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
    Total Submission(s): 0    Accepted Submission(s): 0


    Problem Description
    There are k piles of stones in a circle, numbered from 0 to k1 , where the number of the stones in each pile is n initially. You can do some round operations, where the initial round is numbered as the 1 -st round.

    The operation of the i -th round is to modify the pile of stones numbered (i1)modk . In each round, you should remove from this pile some stones (at least one stone), satisfying that the number of stones in this pile before this operation is a multiple of the number of stones in this pile after operation, which means that you ought to remain at least one stone in this pile.

    The game is ended if there exists at least one pile containing only one stone. Given two positive integers n and k , your task is to calculate for each pile the number of the possible operation plans that it is the last operated pile before the game is ended.

    The integer n may be very large, so the prime-factor decomposition of n will be given, in other words, if n=mi=1peii , then the integers m and (pi,ei) (1im) will be given, but the integer n will not.

    The answer may be very large, so you only need to give the value of the answer modulo 985661441 .
     
    Input
    The input contains multiple test cases.

    For each test case:

    The first line contains two positive integers m and k , satisfying that 1m,k10 .

    In next m lines, the i -th line contains two positive integers pi and ei , satisfying that 2pi109, ei1, mi=1ei105 .

    It is guaranteed that p1,p2,,pm are distinct.

    About 200 test cases in total, where no more than 5 cases satisfy mi=1ei104 .
     
    Output
    For each test case, output "Case #x : y0 y1 yk1 " in one line (without quotes), where x indicates the case number starting from 1 and yi (0i<k) denotes the number of the possible operation plans modulo 985661441 for the pile numbered i of corresponding case.
     
    Sample Input
    1 1 2 2 2 1 3 1 5 1 1 2 2 3 2 2 2 4 5 4
     
    Sample Output
    Case #1: 2 Case #2: 3 Case #3: 6 4 Case #4: 1499980 1281085
  • 相关阅读:
    C# Excel导出超出65536行报错 Invalid row number (65536) outside allowable range (0..65535)
    C# 获取指定类型的文件
    C# 控制台定时器
    C# 去除Split()中去除内容为空的数据
    C#获取当前服务器运行程序的根目录,获取当前运行程序物理路径
    C#实体转为json字符串
    C#Split的用法,Split分割字符串
    C#直接引用js文件调js里的数据
    java虚拟机学习记录(内存划分、垃圾回收、类加载等机制)
    关于MySQL数据库事务的机制学习总结
  • 原文地址:https://www.cnblogs.com/Roni-i/p/7233427.html
Copyright © 2020-2023  润新知