![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PAT
Wickingdone
这个作者很懒,什么都没留下…
展开
-
1060 Are They Equal (25分)
1060 Are They Equal (25分) 1.首先对输入数据进行清0操作,详见del0: 去头直到遇见非0元素,中途发现size==0,则改s为0 之后,若s头为小数点,则去尾 2.获得指数k 3.获得有效位d #include <iostream> #include <math.h> #include <string> using namespace std; int n; void del0(string &s) { while ( s[0]原创 2020-09-04 18:29:52 · 82 阅读 · 0 评论 -
1064 Complete Binary Search Tree
树的表示 完全二叉树,可以使用数组表示 父节点:r 左子节点:2r+1 右子节点:2r+2 获得左右子树的大小 左边界 l,右边界 r【输入数组tree】 区间的节点数 num = r - l + 1; 树的高度 h = floor(log2(num));【根节点为0层】 最后一层节点数 last = num - pow(2, h) + 1;【总节点数-非叶子层节点数】 左子树最后一层能容纳的节点数 t = pow(2, h - 1); #include <iostream> #include原创 2020-08-29 13:58:18 · 98 阅读 · 0 评论 -
1026 Table Tennis Python实现
1026 Table Tennis Python实现 1.占用时间不能超过两小时 2.vip优先选择vip空桌,而非编号最小的空桌 def stot(w:str): h=int(w[:2]) m=int(w[3:5]) s=int(w[6:]) return (h*60+m)*60+s def ttos(x:int): res="" h=str(x//3600) res+="0"+h+":" if len(h)==1 else h+":" x%原创 2020-08-25 21:32:44 · 159 阅读 · 0 评论 -
038 Recover the Smallest Number Python实现
1038 Recover the Smallest Number Python实现 import functools line=input().split(" ") n=line[0] list=line[1:] def scmp(a,b): if a+b>b+a: return 1 elif a+b<b+a: return -1 else: return 0 list=sorted(list,key=functools.原创 2020-08-21 23:58:43 · 146 阅读 · 0 评论 -
1034 Head of a Gang python实现
1034 Head of a Gang python实现 图:字典里装字典 gang:dfs k:边重复存储,阈值比较需乘2 n,k=[int(x) for x in input().split(" ")] dic={} for _ in range(n): a,b,w=input().split(" ") w=int(w) if a not in dic: dic[a]={b:w} elif b not in dic[a]: dic[a][b原创 2020-08-21 21:10:44 · 152 阅读 · 0 评论 -
1116 Come on! Let‘s C
1116 Come on! Let's C 题目链接考察点代码详情 题目 链接 https://pintia.cn/problem-sets/994805342720868352/problems/994805355358306304 考察点 质数理解 代码详情 python3 def isprime(x): if x==1: return False for i in range(2,int(pow(x,0.5)+1)): if x%i==0:原创 2020-08-20 15:55:37 · 129 阅读 · 0 评论