摘要: prthon 反斜杠为转义字符 >>> str='C:\now' >>> str 'C:\now' >>> print(str) SyntaxError: invalid character ')' (U+FF09) >>> print('C:\noe') C: oe 字符串前加'r',为原始字符 阅读全文
posted @ 2021-09-13 19:42 蓝猫爱宇宙 阅读(385) 评论(0) 推荐(0) 编辑
摘要: The 15-puzzle has been around for over 100 years; even if you don't know it by that name, you've seen it. It is constructed with 15 sliding tiles, eac 阅读全文
posted @ 2018-11-29 17:39 蓝猫爱宇宙 阅读(161) 评论(0) 推荐(0) 编辑
摘要: Problem Description Given two positive integers G and L, could you tell me how many solutions of (x, y, z) there are, satisfying that gcd(x, y, z) = G 阅读全文
posted @ 2018-11-02 17:12 蓝猫爱宇宙 阅读(93) 评论(0) 推荐(0) 编辑
摘要: Description 给定N个字符串(第i个字符串长度为Mi,字符串内包含数字、大小写字母,大小写敏感),请求出N个字符串中共有多少个不同的字符串。 Input 输入,第一行一个N 接下来N行每行包含一个字符串 Output 输出不同字符串的个数 Sample Input Sample Outpu 阅读全文
posted @ 2018-08-01 20:20 蓝猫爱宇宙 阅读(332) 评论(0) 推荐(0) 编辑
摘要: 组合数取模——————卢卡斯定理 //组合数取模——————卢卡斯定理 //扩展欧几里得求逆元 int exgcd(int a,int b,int &x,int &y)//扩展欧几里得 { if(b==0) { x=1;y=0;return a; } else { int gcd=exgcd(b,a 阅读全文
posted @ 2018-07-31 11:43 蓝猫爱宇宙 阅读(103) 评论(0) 推荐(0) 编辑
摘要: DFS(深度优先搜索) 从起点出发,朝任一个可能的方向走,走过的点要做标记,一直向前走。若走不了了,就回退一步,从这一个状态走向没有走过的另一个方向。 之所以称为深度优先搜索,因为它是朝着一个方向一直走到底,以深度优先,然后回溯。 DFS一般用的是递归的方法。 迷宫问题 给一个迷宫,0表示道路,1表 阅读全文
posted @ 2018-07-29 20:39 蓝猫爱宇宙 阅读(176) 评论(0) 推荐(0) 编辑