- 博客(30)
- 收藏
- 关注
原创 unity profiler 中 EditorLoop占用过高
Layout重置,重启电脑都没用。最后发现是有道词典画词功能一直触发编译器重排,气笑了。(有道词典开机运行)遇到这个问题的可以看看后台是不是有道词典开着画词。
2025-09-18 20:32:45
273
1
原创 二叉树
结构体 struct node { typename data;//可增加其他变量 node* lchild; node* rchild; }; 先序遍历 void preorder(node* root) { if (root==NULL) { return; } printf("%d\n", root->data); preorder(root->lchild...
2020-02-28 20:46:42
170
原创 1081 检查密码 (15分)
python原博客 python大法好 import re n=int(input()) for i in range(n): ipt=input(); if len(ipt)<6: print("Your password is tai duan le.") else: a=re.findall(r'[^A-Za-z0-9.]',...
2020-02-05 23:28:11
273
原创 大数运算
大数运算 struct bign { int d[110]; int len; bign() { len = 0; } }; bign change(char str[]) { bign a; a.len = strlen(str); for (int i = 0; i < a.len; i++) { a.d[i] = str[a.len - i - 1] - '0...
2020-02-04 15:33:15
149
原创 1069 微博转发抽奖 (20分)
理解真的太重要了: 延顺之后不用重新回到原来的中奖点 #include<iostream> #include<map> using namespace std; int main() { int m, n, s; cin >> m >> n >> s; map<string, int> mp; char zhf[10...
2020-02-03 16:57:59
177
原创 1068 万绿丛中一点红 (20分)
输出时横纵坐标搞反了,我裂开,浪费我半小时。 #include<iostream> #include<vector> #include<cstring> #include<algorithm> #include<math.h> using namespace std; int a[1010][1010]; int ju[0x100000...
2020-02-03 16:23:11
165
原创 1055 集体照 (25分)
臭长臭长的代码 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<math.h> #include<iomanip> using namespace std; const int maxn = 10010; i...
2020-02-02 16:38:59
186
原创 1054 求平均值 (20分)
测试点2 :当合法数字个数为1是 numbers不用加s。。。 我裂开。所以说没事学学英语还是有道理的 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<math.h> #include<iomanip> usi...
2020-02-02 14:57:09
131
原创 1051 复数乘法 (15分)
注意-0.005~0.005这段范围的取符号; 比如B<0&&B>-0.005,此时应该输出+0.00,如果直接判断B的正负会输出-0.00 #include<iostream> #include<cstdio> #include<algorithm> #include<math.h> #include<iomani...
2020-02-02 13:13:19
183
原创 1050 螺旋矩阵 (25分)
!!!建议开大数组的时候放在主函数外面!!! #include<iostream> #include<algorithm> #include<math.h> using namespace std; const int maxn = 10010; int a[10000][1000] = { 0 };//放主函数外面!!! int main() { int ...
2020-02-02 12:29:43
160
原创 1044 Shopping in Mars (25分)
革命尚未成功,同志还需努力! #include<iostream> #include<math.h> using namespace std; const int maxn = 100010; int m, n, sum[maxn] ; int upper_bound(int a[], int l, int r, int x) { int mid; while (l&...
2020-02-01 10:55:11
167
原创 1035 插入与归并 (25分)
好好回顾一下各个排序; 这里涉及插入O(n²),归并O(n logn)。 #include<iostream> #include<cstring> #include<algorithm> #include<map> using namespace std; const int maxn = 110; int n; bool cmp(int a[],...
2020-01-31 22:07:55
192
原创 1033 旧键盘打字 (20分)
应该不用map,直接用ASCII码,128位: bool hash[128]; 测试点2,坏键可能没有: 用cin.getline。 #include<iostream> #include<cstring> #include<algorithm> #include<map> using namespace std; const int maxn = ...
2020-01-31 21:30:38
203
原创 1025 反转链表 (25分)
VS不能直接用下标新建,会报错; #include<iostream> #include<cstdio> #include<algorithm> #include<vector> using namespace std; struct node { int addr, data, next; }; int main() { int st, n,...
2020-01-31 12:16:02
189
原创 1024 Palindromic Number (25分)
大树运算,练熟; 测试点6,8超出范围; #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int maxn = 10010; struct bign { int d[100]; int len; bign() { memset(d, 0...
2020-01-30 22:08:44
849
原创 1096 Consecutive Factors (20分)
关键点: n的因子最大不超过√n #include<iostream> #include<vector> #include<math.h> using namespace std; typedef long long LL; const int maxn = 10010; int main(){ LL n,np; cin >> n; np = ...
2020-01-30 15:11:52
145
原创 1078 Hashing (25分)
测试点4 二次方探查:仅向正方向,即+11,+22,+3*3…… #include<iostream> #include<vector> using namespace std; const int maxn = 10010; bool p[maxn] = { 0 }; int x[maxn] = { 0 }; void Init() { p[1] = true; ...
2020-01-30 14:27:06
240
原创 1015 Reversible Primes (20分)
测试点2 1不是素数 #include<iostream> #include<vector> using namespace std; const int maxn = 100010; bool p[maxn] = { 0 }; int x[maxn]; void Init() { p[1] = true; for (int i = 2; i < maxn;...
2020-01-29 23:00:57
201
原创 1088 Rational Arithmetic (20分)
测试点3 乘法可能会溢出,用long long #include<cstdio> using namespace std; const int maxn = 110; long long gcd(long long a, long long b) { if (b == 0)return a; else return gcd(b, a%b); } struct fs { lon...
2020-01-29 21:40:16
175
原创 1049 Counting Ones (30分)
#include<cstdio> const int maxn = 100010; int main() { int n,a=1,sum=0; int left, now, right; scanf("%d", &n); while (n/a!=0) { left = n / (a * 10); now = n / a % 10; right = n ...
2020-01-29 16:17:43
181
原创 1104 Sum of Number Segments (20分)
有一个有点坑,要注意: 因为n的最大值为100000,I*(n+1-i)乘积最大为50000*50000>2^31-1,会造成溢出 #include<cstdio> const int maxn = 100010; int main() { int n; double sum = 0,a; scanf("%d", &n); for (int i = 1; i &...
2020-01-29 15:08:35
138
原创 1010 Radix (25分)
测试点 7 8 10 为通过。 #include<iostream> #include<cstring> #include<algorithm> using namespace std; const int maxn = 100010; long long a1 = 0, b = 0; int ctoint(char c) { { if (c >=...
2020-01-21 22:40:09
402
原创 1030 完美数列 (25分)
#include<iostream> #include<algorithm> using namespace std; const int maxn = 100010; int a[maxn],n,p; int binarySearch(int i, long long x) { if (a[n - 1] <= x)return n; int l = i + ...
2020-01-21 18:50:24
136
原创 1038 Recover the Smallest Number (30分)
#include<iostream> #include<cstring> #include<string> #include<algorithm> using namespace std; const int maxn = 100010; bool cmp(string a, string b) { return a+b < b+a; } ...
2020-01-21 15:55:44
100
原创 1033 To Fill or Not to Fill (25分)(有空重写一次
#include<cstdio> #include<cstring> #include<string> #include<algorithm> using namespace std; const int maxn = 1000; struct Oil { double prize, dis; }a[maxn]; bool cmp(Oil a,...
2020-01-18 21:31:32
243
原创 1095 Cars on Campus (30分)
利用map存取车的停车时间: #include<cstdio> #include<cstring> #include<algorithm> #include<map> using namespace std; const int maxn = 10010; int num; struct Car { char no[10]; int t; ...
2020-01-18 14:14:01
1927
原创 甲级PAT 1080 Graduate Admission (30 分)(排序)
测试1,2错误 找了两个多小时,发现里面的节点应该用原来的no也就是ap[i].no,而不是i if (sc[ap[i].zy[j]][0] > 0||(ki[ap[i].zy[j]]!=1&& ap[ap[i].no].rank == ap[sc[ap[ap[i].no].zy[j]][ki[ap[ap[i].no].zy[j]] - 1]].rank)) 最终代码: #...
2020-01-18 00:09:54
426
1
原创 PAT 1060 Are They Equal (25分)
If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123×10^5 with simple chopping. Now given the number of signif...
2020-01-17 20:09:07
292
原创 从零开始的编程
算法笔记从零开始2020/1/16前言今日算法01:归并排序今日算法02:快速排序: 2020/1/16 前言 每天坚持写点东西,从基础算法开始做起; 今日算法01:归并排序 时间复杂度:O(nlogn) 1.递归实现: #include<cstdio> const int maxn = 100; int calcount = 0;//统计计算次数; void merge(int A...
2020-01-16 20:03:42
290
原创 从零开始的编程
算法笔记从零开始2020/1/15前言今日算法01:简单贪心区间贪心 2020/1/15 前言 每天坚持写点东西,从基础算法开始做起; 今日算法01:简单贪心 贪心算法(又称贪婪算法)是指,在对问题求解时,总是做出在当前看来是最好的选择。也就是说,不从整体最优上加以考虑,他所做出的是在某种意义上的局部最优解。 区间贪心 1.问题简介:区间不相交问题,给出N个开区间(x,y),从中选择尽可能多的开区...
2020-01-15 20:00:03
1529
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅