02 2024 档案
摘要:正好最近和队友决定再过一遍基础,那就用这个博客这个记录一下吧 part one : 高精度部分 791. 高精度加法 - AcWing题库 #include<iostream> #include<vector> using namespace std; const int N=100010; str
阅读全文
摘要:P2241 统计方形(数据加强版) - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) #include<bits/stdc++.h> using namespace std; typedef long long ll; const int INF=0x3f3f3f3f; ll n,m
阅读全文
摘要:第二次,三道题,剩下的回学校再补,总结:还是需要多练习 A:让数列里所有的1都挨在一起,可以看出,相邻 1 之间有多少个 0 就需要操作几次,特判:当只有一个 1 或者原本全是 1 就输出 0; void solve(){ cin>>n; int top1=0,top2=0,cnt=0; memse
阅读全文
摘要:写了可能放假前的最后一场CF,明天就开学了,要是学校没有宵禁,而且有24时营业的教室就好了,可能又要过上每天背着电脑平板到处跑的日子了,恼火啊啊aa😫,没事,再坚持两年就好了
阅读全文
摘要:P3156 【深基15.例1】询问学号 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) #include<bits/stdc++.h> using namespace std; typedef long long ll; const int INF=0x3f3f3f3f; int
阅读全文
摘要:Dashboard - Codeforces Round 928 (Div. 4) - Codeforces 第一次参加CF,最后一道题连题都没读,下次不会就跳,菜是原罪 A:找字符串中A,B数量,遍历一下最后比较即可 B:判断是三角形还是正方形,题目表示除了正方形就是三角形,所以直接判断是不是正方
阅读全文
摘要:P1540 [NOIP2010 提高组] 机器翻译 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 从学计组学到操作系统,学了很多算法,对于这种偏硬件的科目,能够在这道题上体现所学的,真的很惊喜了! #include<bits/stdc++.h> using namespace s
阅读全文
摘要:3134 -- Power Calculus (poj.org) 相当于是问1经过多少次能变成n,val[pos]<<(depth-now)为估计函数,如果最快都不能到n,就return false #include<iostream> using namespace std; const int
阅读全文
摘要:今天之后就进入了新的一年。 去年的上半年算是糊糊涂涂过去的,六月份军训结束状态好了一些,至少心里有想去的地方了。下半年转专业到了计算机系,刚开学那段时间每天背着游戏本和一千多页的java编程思想,四处找空教室自习,偶尔被社团办活动的请出去。因为笔记本老没电,开始寻找插头,一星期做了一个机器臂进了实验
阅读全文
摘要:P2240 【深基12.例1】部分背包问题 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=110; int n,t; st
阅读全文
摘要:Problem - 5113 (hdu.edu.cn) hdu没法提交,我以为我账号又崩了... #include<iostream> #include<cstring> using namespace std; int T,n,m,k,kase; int color[30],ans[10][10]
阅读全文
摘要:Problem - 1175 (hdu.edu.cn) 根据转弯次数和有没有找到答案来剪枝 #include<iostream> #include<cstring> using namespace std; const int N=1010; int n,m,q,x1,y1,x2,y2,flag;
阅读全文
摘要:1129 -- Channel Allocation (poj.org) 这道题的实质是图的着色问题,连通的结点不能用一种颜色 #include<iostream> #include<cstring> using namespace std; const int INF=0x3f3f3f3f; bo
阅读全文
摘要:2676 -- Sudoku (poj.org) #include<iostream> #include<cstring> using namespace std; int n,map[10][10]; bool row[10][10],col[10][10],grid[10][10]; bool
阅读全文
摘要:1416 -- Shredding Company (poj.org) #include<iostream> #include<cstring> using namespace std; char num[10]; int t,max_cnt,max_sum,shred_cnt,ans[10],tm
阅读全文
摘要:之前hduoj的账号用不了了,今天刘春英老师居然亲自登号帮忙,coding之路真的加buff了!
阅读全文
摘要:2531 -- Network Saboteur (poj.org) #include<iostream> #include<cstring> using namespace std; const int N=30; int n,ans,C[N][N]; bool group[N]; void DF
阅读全文
摘要:P1219 [USACO1.5] 八皇后 Checker Challenge - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) #include<iostream> using namespace std; int n,m1[30],m2[30],m3[30],ans[15],res
阅读全文
摘要:P1226 【模板】快速幂 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) #include<iostream> #include<cstring> using namespace std; typedef long long ll; ll a,b,p; ll quickpow(l
阅读全文
摘要:2299 -- Ultra-QuickSort (poj.org) #include<iostream>//归并排序 #include<cstring> using namespace std; typedef long long ll; const int N=500010; int a[N],t
阅读全文
摘要:Problem - 2037 (hdu.edu.cn) #include<iostream>/*活动安排的贪心问题*/ #include<algorithm> using namespace std; const int N=110; int n; struct node{ int begin,en
阅读全文
摘要:Problem - 2553 (hdu.edu.cn)(N <= 10) #include<iostream> #include<cstring> using namespace std; int n,tot=0; int col[12]; bool check(int c,int r){ for(
阅读全文
摘要:吃完晚饭,啃着tomato来poj上提交,结果不支持unordered_map,吐血啦,看来还是要用BFS+康托展开,还想再写一篇双向BFS的,对这道题算是圆满了*_*,但是要用G++提交,C++会报错我也不知道为嘛 #include<iostream> #include<cstring> #inc
阅读全文
摘要:1077 -- Eight (poj.org) 由结论可以知道逆序对为奇数的时候无解,f为估值函数,计算曼哈顿距离。 想用康托展开写,但多状态数码问题用数组存储状态不够,有TLE的风险,还是A*吧! 吃一个tomato宣告今日...不知道结不结束 #include<iostream> #includ
阅读全文
摘要:Problem - 1312 (hdu.edu.cn) BFS模板题 #include<iostream> #include<queue> using namespace std; typedef long long ll; const int INF=0x3f3f3f3f; int wx,hy,n
阅读全文
摘要:Problem - 4460 (hdu.edu.cn) 写完提交答案错了,后面发现vis初始化的地方错了,以前BFS都只调用一次,看来我中毒太深。这个题更能体现BFS的特性,增加dis数组记录距离。 #include<iostream> #include<queue> #include<cstrin
阅读全文
摘要:Problem - 1240 (hdu.edu.cn) 三维的BFS,存在一个坐标点的变换,即输入的是 (y , z , x),进行转换即可 #include<iostream> #include<queue> #include<cstring> using namespace std; int n
阅读全文
摘要:3414 -- Pots (poj.org) 这道题需要输出最后结果的执行过程,可以通过结构体,在结构体中定义一个数组s,s中存储了每一步的执行过程,实现了回溯。并且在运行中可以适当剪枝,减少枚举次数。 #include<iostream> #include<queue> #include<cstr
阅读全文
摘要:#include<iostream> using namespace std; typedef unsigned long long ull; int n,k; void DFS(ull ans,int n,int count){ if(!k || count==18 ) return ; if(a
阅读全文
摘要:#include<iostream> #include<queue> #include<cstring> using namespace std; const int N=1e5+10; int n,k,line[N],way; struct node{int loc,step;}; queue<n
阅读全文
摘要:#include<iostream> #include<queue> #include<cstring> const int N=10010; int t,aa,bb,prime[N],vis[N],step[N]; using namespace std; void prime_(){ //埃式筛
阅读全文