实验吧 手脑并用

Posted 时光不改

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了实验吧 手脑并用相关的知识,希望对你有一定的参考价值。

手脑并用

 

对N!进行数学分析

解题链接: http://ctf5.shiyanbar.com/ppc/1.txt

 

求6789!的值末尾有几个零?

 

解题思路:

好吧,这感觉是一道送分题,求6789的阶乘

因为网上这个算法很多呀,求出这个阶乘复制一下后面的0,然后求和就可以了。

 

#!/usr/bin/python3
 
# Filename : test.py
# author by : www.runoob.com
 
# 通过用户输入数字计算阶乘
 
# 获取用户输入的数字
num = 6789
factorial = 1
 
# 查看数字是负数,0 或 正数
if num < 0:
   print("抱歉,负数没有阶乘")
elif num == 0:
   print("0 的阶乘为 1")
else:
   for i in range(1,num + 1):
       factorial = factorial*i
   # print("%d 的阶乘为 %d" %(num,factorial))

string = "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
print(len(string))

 

以上是关于实验吧 手脑并用的主要内容,如果未能解决你的问题,请参考以下文章

201555332盛照宗—网络对抗实验1—逆向与bof基础

不要在片段中显示列表视图项

20155201 李卓雯 《网络对抗技术》实验一 逆向及Bof基础

替换未调用 onAttach、onCreate、onCreateView 等的活动中的片段

使用 React 实验性中继片段:缺少属性 '"$fragmentRefs"'

汇编语言实验5