摘要:
水题#include #include #include using namespace std;int main(){ int n,d,t; cin >> n >> d; for(int i = 0 ; i > t; d-=t; } d-=(n-1)*1... 阅读全文
摘要:
解决本题的一个关键点就是当Cat进入时,此时Rat在哪个位置?注意移动方向可以随时改变,由于是圆环,故离入口最远点的距离是pi*R,即圆的一半,当cat进入时(cat的速度大于rat的速度,否则不可能追上) 如果rat移动的距离小于圆环的一半,即此时rat的位置为移动最远的位置 如果rat移动的... 阅读全文
摘要:
比较简单的一题,纠结比较久的是把my_cmp和my_minus放在类中,利用sort函数会出现no matching function for call to ""sort(std::vector::iterator, std::vector::iterator, )""当把这两个函数放在类外面时就... 阅读全文
摘要:
关于斐波那契数列,由于数据量比较小, 直接打表了,代码写的比较戳#include #include #include using namespace std;class FibonacciDiv2{public: vector table; void make_table(){ ... 阅读全文
摘要:
注意题目这句话,Once you have each type of candies in a box, you want to pack those boxes into larger boxes, until only one box remains.两个box合并后必须放入更大一个盒子题目的有... 阅读全文
摘要:
Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?借用博... 阅读全文
摘要:
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?求链表是否有环的问题,要考虑链表为空的情况,定义一个快指针和一个慢指针,如果快指针和... 阅读全文
摘要:
Search Insert PositionTotal Accepted:15484Total Submissions:44816Given a sorted array and a target value, return the index if the target is found. If ... 阅读全文
摘要:
本人比较喜欢amix它集成了很多插件。1、mru.vim:用于打开最近使用过的文件 使用命令: :MRU 打开最近的文件列表 上下箭头可以移动关标 :o 在新窗口中打开文件2、NERD Tree:用于打开项目或者文件夹目录,具体命令可以输入 :help NERD_t... 阅读全文
摘要:
题目简单描述就是求数组中[l,r]区间的和#include #include #include #include #include using namespace std;int main(){ int n,m; cin >> n; vector v(n+1,0); for(... 阅读全文
摘要:
解决思路是统计100的个数为cnt1,200的个数为cnt2则cnt1 cnt2奇数 奇数 奇数 偶数偶数 奇数偶数 偶数当cnt1为奇数时一定剩余一个100,不能均分,所以输出结果为NO 当cnt1为偶数且cnt2为偶数则肯定能均分当cnt1为偶数且cnt2为奇数时 ... 阅读全文
摘要:
new文件用来管理c++的动态内存,这个文件声明了几个全局空间的函数(不是std空间的函数,全局空间的函数调用时是用全局作用域解析符),包括operator new 和operator delete的重载 ,这些函数用于处理动态存储空间请求。其new的头文件源代码#ifndef _NEW#defin... 阅读全文
摘要:
题目的意思是求出每个队穿主场衣服和客场衣服的次数每个队作为主场的次数是n-1,作为客场的次数是n-1当每个队打主场的时候肯定穿的主场衣服当每个队打客场时,如果客场与主场的衣服不同,则穿客场衣服 如果客场与主场的衣服相同,则穿主场衣服则只需要标记主场每种衣服有多少球队,当作为客场时查... 阅读全文
摘要:
给定n k以及n个人已参加的比赛数,让你判断最少还能参加k次比赛的队伍数,每对3人,每个人最多参加5次比赛#include using namespace std;int main(){ int n,k, cnt = 0; cin >> n >> k; for(int i = 0 ... 阅读全文
摘要:
sudo apt-get install terminatorCtrl-Shift-E: 垂直分割Ctrl-Shift-O: 水平分割Ctrl-Shift-P: 激活先前的窗口Ctrl-Shift-N: 激活下一个窗口Ctrl-Shift-W: 关闭当前窗口.Ctrl-Shift-Q: 退出 阅读全文
摘要:
关于c++多态,个人认为就是父类调用子类的方法,c++多态的实现主要通过虚函数实现,如果类中含有虚函数,就会出现虚函数表,具体c++多态可以参考《深度探索c++对象模型》c语言模拟多态主要通过函数指针实现,可以参考《Object Orientated Programming in ANSI-C》//... 阅读全文
摘要:
图像有用区域时间限制:3000ms | 内存限制:65535KB难度:4描述“ACKing”同学以前做一个图像处理的项目时,遇到了一个问题,他需要摘取出图片中某个黑色线圏成的区域以内的图片,现在请你来帮助他完成第一步,把黑色线圏外的区域全部变为黑色。 图1 图2已知黑线各处不会出现交叉(如图2),... 阅读全文
摘要:
题目是选出c个连续的囚犯,而且囚犯的级别不能大于t#include using namespace std;int main(){ int n,t,c; cin >> n >> t >> c; int a,cnt = 0, res =0;; for(int i = 0 ; i... 阅读全文
摘要:
题目的意思就是找出未能及时处理的犯罪数,#include using namespace std;int main(){ int n; cin >> n; int a,recruit = 0, crimes = 0;; for(int i = 0 ; i > a; ... 阅读全文
摘要:
解决办法是将qmake换成4.8的,qmake5.2的支持opencv支持的不是很好 阅读全文
摘要:
ubuntu安装opencv(1)安装编译opencv的环境sudo apt-get -y install build-essential cmake pkg-config(2)安装Image I/O库sudo apt-get -y install libjpeg62-dev sudo apt-ge... 阅读全文
摘要:
zb的生日时间限制:3000ms | 内存限制:65535KB难度:2描述今天是阴历七月初五,acm队员zb的生日。zb正在和C小加、never在武汉集训。他想给这两位兄弟买点什么庆祝生日,经过调查,zb发现C小加和never都很喜欢吃西瓜,而且一吃就是一堆的那种,zb立刻下定决心买了一堆西瓜。当他... 阅读全文
摘要:
红黑树时间限制:3000ms | 内存限制:65535KB难度:3描述什么是红黑树呢?顾名思义,跟枣树类似,红黑树是一种叶子是黑色果子是红色的树。。。当然,这个是我说的。。。《算法导论》上可不是这么说的:如果一个二叉查找树满足下面的红黑性质,那么则为一个红黑树。1)每个节点或是红的,或者是黑的。2)... 阅读全文
摘要:
最少步数时间限制:3000ms | 内存限制:65535KB难度:4描述这有一个迷宫,有0~8行和0~8列:1,1,1,1,1,1,1,1,11,0,0,1,0,0,1,0,11,0,0,1,1,0,0,0,11,0,1,0,1,1,0,1,11,0,0,0,0,1,0,0,11,1,0,1,0,1... 阅读全文
摘要:
水池数目时间限制:3000ms | 内存限制:65535KB难度:4描述南阳理工学院校园里有一些小河和一些湖泊,现在,我们把它们通一看成水池,假设有一张我们学校的某处的地图,这个地图上仅标识了此处是否是水池,现在,你的任务来了,请用计算机算出该地图中共有几个水池。输入第一行输入一个整数N,表示共有N... 阅读全文
摘要:
下载Firefox 29.0% cd ~/Downloads% sudo cp firefox-29.0.tar.bz2 /opt% cd /opt% sudo tar -xvjf firefox-29.0.tar.bz2然后% sudo ln -sf /opt/firefox/firefox /... 阅读全文
摘要:
由于n比较小,直接暴力解决#include #include #include #include #include #includeusing namespace std;int main(){ int n,k; cin >> n >> k; vector a(n); for... 阅读全文
摘要:
#include #include #include using namespace std;int main(){ int n,m; cin >> n >> m; vector > a(n,vector(m,0)); for(int i = 0; i > a[i][j]; ... 阅读全文
摘要:
#include #include #include #include using namespace std;int main(){ int n,s; cin >> n >> s; vector a(n); for(int i = 0 ; i > a[i]; sort... 阅读全文
摘要:
blockhouses时间限制:1000ms | 内存限制:65535KB难度:3描述Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and... 阅读全文
摘要:
spiral grid时间限制:2000ms | 内存限制:65535KB难度:4描述Xiaod has recently discovered the grid named "spiral grid".Construct the grid like the following figure. (T... 阅读全文
摘要:
数独时间限制:1000ms | 内存限制:65535KB难度:4描述 数独是一种运用纸、笔进行演算的逻辑游戏。玩家需要根据9×9盘面上的已知数字,推理出所有剩余空格的数字,并满足每一行、每一列、每一个3*3宫内的数字均含1-9,不重复。 每一道合格的数独谜题都有且仅有唯一答案,推理方法也以此为... 阅读全文
摘要:
注意题目一次只能改变一个松鼠,Pasha can make some hamster ether sit down or stand up.是单数不是复数#include #include #include #include #include using namespace std;int main... 阅读全文
摘要:
按照半径排序,然后累加人数直到超过百万#include #include #include #include #include using namespace std;int main(){ int n,s; cin >> n >>s; map a; for(int i = ... 阅读全文
摘要:
解题思路是:Q=q1^q2.......^qn = p1^p2......^pn^((1%1)^....(1%n))^((2%1)^......(2%n))^....故Q的求解过程分成两部分第一部分是求p1^p2......^pn第二部分是求((1%1)^....(1%n))^((2%1)^....... 阅读全文
摘要:
题目的意思是老板给n个人发工资,x欠y的工资,the joy of personxfrom his brand new money reward will be much less,老板想避免x后面是y领工资,故利用bfs,找到无后继的点在提交代码的时候输出时格式好像没有oj的平台那么严,可以包含多... 阅读全文
摘要:
水题#include #include #include using namespace std;int main(){ int n,a,b; cin >> n >>a >> b; vector apple(n+1,0); int k; for(int i = 0 ; ... 阅读全文
摘要:
需要满足的条件是(1)每个字母是对称的(2)每个字符串是对称的#include #include #include using namespace std;const string mirrorChar = "AHIMOTUVWXY";int main(){ string str; ci... 阅读全文
摘要:
Same binary weight时间限制:300ms | 内存限制:65535KB难度:3描述The binary weight of a positive integer is the number of 1's in its binary representation.for example... 阅读全文
摘要:
擅长排列的小明时间限制:1000ms | 内存限制:65535KB难度:4描述小明十分聪明,而且十分擅长排列计算。比如给小明一个数字5,他能立刻给出1-5按字典序的全排列,如果你想为难他,在这5个数字中选出几个数字让他继续全排列,那么你就错了,他同样的很擅长。现在需要你写一个程序来验证擅长排列的小明... 阅读全文