{"repo":"miaotony/calc114514","free":true,"listed":false,"github":"https://github.com/miaotony/calc114514","clone":"git clone https://github.com/miaotony/calc114514.git","description":"Calculate a number with 114514 & some operators.","language":"Python","stars":17,"topics":["telegram-bot","serverless","vercel","114514","backend","frontend"],"license":"AGPL-3.0","category":"workflow-automation","readme_excerpt":"Calc 114514 数字论证器 Calculate a number with 114514 &amp; some operators. 利用 114514 及一些运算符构造出所给的数字。 数字论证是一种常见的定理证明方法。 简单来说，就是对于给定的自然数，找出一个等值的表达式，如果该表达式去除所有符号部分后为字符串「114514」，则完成论证。表达式仅允许整数运算，可以使用括号、常见的代数运算符 +- /% 和位运算符 ^& 。 Via: USTC Hackergame 2020 See also: 超精巧的数字论证器 (official writeup) Demonstration method 论证算法 六位数以内论证方法 在不超过6位数，即 0 一个办法就是 按照十进制的方式来凑 ，即 given number = (((((((0+a) 10+b) 10+c) 10+d) 10)+e) 10)+f ，其中 a b c d e f 为 0 到 9 之间的整数。表达式中的值 0 10 10 10 10 10 可以分别利用 1 1 4 5 1 4 与嵌套 - 来凑出，而 +a +b +c +d +e +f 可以直接利用嵌套 - 来实现（不需要使用数字）。 超过六位数的论证方法 对于所给整数 n ，采用与十进制类似的方法，在 $ n^{1/6} $ 附近取六个数，每位取不同进制，最后再凑到所给的数。 （TODO） FrontEnd 前端 前端在 Hackergame 2020 签到题的基础上魔改而成。 基于 Vercel 完成部署。 详见： https://calc114514.vercel.app/ 另外也部署到了 CloudFlare Pages: https://114514.pages.dev/ BackEnd 后端 后端使用 Python3 及 Flask 进行开发。 基于 Vercel 的 Serverless Function 完成部署。 （Serverless 真香！） API 开放接口 GET / POST https://calc114514.vercel.app/api/calc Param: num a number here. isJson Optional. If 1 , return the result(s) with JSON format, else return text/plain result. Return: See examples below. Examples: Telegram bot See @calc114514bot. Usage: 1. Send a number to @calc114514bot. 2. Use inline query method, @calc114514bot . 第一个不带原数，第二个带原数，效果分别如下所示。 Development 开发说明 接口相关代码位于 /api/ 目录下， main.py 内包含了开放接口和 bot 交互的相关接口。 bot 采用 Webhook 方式处理发来的消息。 1. Install the requirements. 2. Edit your Telegram bot token and Webhook URL path in the secret.example.py . 3. Rename secret.example.py to secret.py . 4. Run the backend, for exampl","default_branch":null,"files":null,"tree":[],"storefront":"/r/miaotony","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/miaotony/calc114514/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}