# NFLS 2019-9-19 Programming Training

NFLS Programming Training 2019-9-19

# A - 求和(sum.cpp)

## Statement

f(n)=a^{n+k} 的第q项到p项的和。

n k q p

In:
2 0 2 3
Out:
12

## Constriants

For 100%: 1\leq q\leq p\leq 10^9,0\leq n,k\leq 10^9

# B - 倍数(multiple.cpp)

T
n1
n2
...
nT

T行。

## Example

In:
3
4
7
11
Out:
1
3
2
Explain:
11\times3=33=(100001)_2

## Constriants

For 40%: 1\leq n\leq20
For 70%: 1\leq n\leq1000
For 100%: 1\leq n\leq10^6,1\leq T\leq 3

# C - 火星语 (opal.cpp)

s

## Example

In:
{[4,3]?(1,2):7}
Out:
3

## Constriants

Subtask 1: 只有()
Subtask 2: 只有()[]

# A - Sum

## Statement

Find the sum of the q-th term to the p-th term of f(n)=a^{n+k}

n k q p

## Output

One integer, module 1e9+7

In:
2 0 2 3
Out:
12

## Constriants

For 100%: 1\leq q\leq p\leq 10^9,0\leq n,k\leq 10^9

# B - Multiple

## Statement

Find the minimal digit '1' in the multiple of the given integer N. You need to solve the question T times.

T
n1
n2
...
nT

T lines.

## Example

In:
3
4
7
11
Out:
1
3
2
Explain:
11\times3=33=(100001)_2

## Constriants

For 40%: 1\leq n\leq20
For 70%: 1\leq n\leq1000
For 100%: 1\leq n\leq10^6,1\leq T\leq 3

# C - Opal

## Statement

Define (a,b)=(a+b)%10000
Define [a,b]=(a<b?0:9999)
Define {a?b:c}=(a%2==1?b:c)
Find the value of a given expression s.

s

One integer

## Example

In:
{[4,3]?(1,2):7}
Out:
3

## Constriants

Subtask 1: S contains operation () only
Subtask 2: S contains operation () and [] only