- 博客(6)
- 资源 (3)
- 收藏
- 关注
原创 【CF水题】CR271 div.2 474A Keyboard
思路:定义一数组储存键位,判断左右位移,数组加减输出即可。#include <cstdio> #include <iostream> #include <cstring> using namespace std; int main() { char z; char s[100]; char x[30]={'q','w','e','r'...
2018-03-30 21:42:59 151
原创 【算法】 排序浅析
在下学识浅薄,如下有一些主流排序方法,供诸君参考借鉴。1.桶排序性能:稳定,快速,牺牲空间换取时间,易于去重;重点:以数组下标储存数据,以元素累计个数;#include <cstdio> #include <iostream> using namespace std; int main() { int x[10000]={0}; int y[10...
2018-03-30 19:51:55 96
原创 【算法】两矩形相交的判定
某好友近日初学程序设计语言时,问了我如题的问题,他的解法是直接暴力模拟所有的情况,然后再进行判定思绪良久,其实可以直接判定两个矩形的中心距离,然后判断其是否皆小于两矩形长的和的一半 和 宽的和的一半 即可;#include <cstdio> #include <iostream> #include <cmath> using namespace std; ...
2018-03-29 20:32:00 1307 1
原创 【算法】任意进制改换
将N进制转化为M进制可以分为两步:1. N->10:直接位权展开即可 eg: 10110 (2) =1*pow(2,4)+.......+0*pow(2,0);2.10->M:这里辗转相除 取余数 逆序输出即可;#include <cstdio> #include <iostream> #include <cstring> #include <...
2018-03-28 20:26:44 203
原创 【算法】台阶问题浅析
首先,让我们来看这样一个例题。小明家门前,有N个台阶,他一次可以跳一步也可以跳两步,试问有多少种跳法?#include <cstdio> using namespace std; int main() { int n,i; int x[100] = {1,2}; printf("请输入台阶数:"); scanf("%d",&n); ...
2018-03-25 21:58:08 470
原创 【算法】鸡兔同笼问题浅析
鸡兔同笼是初步编程中常见的问题,我们可以列出以下式子:Chicken + Rabbit = Head2 * Chicken + 4 * Rabbit = Foot由上述可得Chicken = ( 4 * Head - Foot ) / 2Rabbit = ( Foot - 2 * Head )/ 2#include <cstdio> #include <iostream>...
2018-03-04 22:32:19 1067
Combinatorics and Graph Theory
2018-12-03
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人