NFLS 2019-9-19 Programming Training

搬运NFLS训练
NFLS Programming Training 2019-9-19
For international readers, please scroll down.

A - 求和(sum.cpp)

Statement

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

Input

n k q p

Output

一个整数,取模10^9+7

Example

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)

Statement

求一个数n的倍数中二进制下1的最小个数。多测

Input

T
n1
n2
...
nT

Output

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)

Statement

表达式计算。
定义 (a,b)=(a+b)%10000
定义 [a,b]=(a<b?0:9999)
定义 {a?b:c}=(a%2==1?b:c)
求表达式的值。

Input

s

Output

一个整数

Example

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

Constriants

Subtask 1: 只有()
Subtask 2: 只有()[]
Subtask 3: 1\leq|S|\leq10^6

English Version

A - Sum

Statement

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

Input

n k q p

Output

One integer, module 1e9+7

Example

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.

Input

T
n1
n2
...
nT

Output

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.

Input

s

Output

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
Subtask 3: 1\leq|S|\leq10^6

版权声明:
作者:XGN
链接:https://blog.hellholestudios.top/archives/283
来源:Hell Hole Studios Blog
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>