F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

simple counting problem

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 131    Accepted Submission(s): 34


Problem Description
Given $m, b, c, n$, please calculate the number of sequence $x_1, x_2, x_3, \dots, x_m$ which satisfies :
$0 \leq x_i\leq b ^ i - c, x_i \in \mathbb{Z}$
$\sum_{i = 1}^{m}{x_i} < n$.
Output the answer module 998244353.
$1\leq m\leq 50$
$2\leq b \leq 10^9, -b + 2 \leq c \leq b - 1$
$1\leq n< b^{m + 1}$
 

Input
There are several test cases, please keep reading until EOF.
For each test case, the first line consists of 3 integers $m, b, c$.
The next line consists of a big integer $n$.
There are 10 test cases.
 

Output
For each test case, output Case #x: y, which means the the test case number and the answer.
 

Sample Input
2 2 1 3
 

Sample Output
Case #1: 5
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 11:18:09, Gzip enabled