QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#209141#6736. Alice and BobluhanningTL 78ms9140kbPython3337b2023-10-10 10:38:432023-10-10 10:38:44

Judging History

你现在查看的是最新测评结果

  • [2023-10-10 10:38:44]
  • 评测
  • 测评结果:TL
  • 用时:78ms
  • 内存:9140kb
  • [2023-10-10 10:38:43]
  • 提交

answer

def factorial(num1,num2):
    a=1
    #for循环遍历
    for i in range(0,num1):
         a*=(num2-i)
    if num1 == 0:
        a = 1
    return a
n = int(input())
ans = 0
p = 998244353
for j in range(1,n+1):
    if n-j >= j-1:
        a = factorial(n-j,n-j)
        b = factorial(j-1,n-j)
        ans+=a*b
print(ans%p)

详细

Test #1:

score: 100
Accepted
time: 10ms
memory: 8976kb

input:

1

output:

1

result:

ok 1 number(s): "1"

Test #2:

score: 0
Accepted
time: 9ms
memory: 9040kb

input:

2

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 14ms
memory: 9064kb

input:

10

output:

997920

result:

ok 1 number(s): "997920"

Test #4:

score: 0
Accepted
time: 6ms
memory: 9040kb

input:

100

output:

188898954

result:

ok 1 number(s): "188898954"

Test #5:

score: 0
Accepted
time: 4ms
memory: 9008kb

input:

4

output:

10

result:

ok 1 number(s): "10"

Test #6:

score: 0
Accepted
time: 9ms
memory: 9140kb

input:

8

output:

12336

result:

ok 1 number(s): "12336"

Test #7:

score: 0
Accepted
time: 15ms
memory: 9068kb

input:

16

output:

373118483

result:

ok 1 number(s): "373118483"

Test #8:

score: 0
Accepted
time: 14ms
memory: 9136kb

input:

32

output:

314585464

result:

ok 1 number(s): "314585464"

Test #9:

score: 0
Accepted
time: 7ms
memory: 9036kb

input:

64

output:

627827331

result:

ok 1 number(s): "627827331"

Test #10:

score: 0
Accepted
time: 14ms
memory: 9040kb

input:

128

output:

828497685

result:

ok 1 number(s): "828497685"

Test #11:

score: 0
Accepted
time: 16ms
memory: 9140kb

input:

256

output:

65697890

result:

ok 1 number(s): "65697890"

Test #12:

score: 0
Accepted
time: 26ms
memory: 9048kb

input:

512

output:

854187619

result:

ok 1 number(s): "854187619"

Test #13:

score: 0
Accepted
time: 78ms
memory: 9032kb

input:

1024

output:

513823539

result:

ok 1 number(s): "513823539"

Test #14:

score: -100
Time Limit Exceeded

input:

1361956

output:


result: