码迷,mamicode.com
首页 >  
搜索关键字:std    ( 41627个结果
double long float类型读入读出 double取模 fmod
The library of fmod is #include #include #include #include #include #include #include using namespace std; int main(){ double x; long y; long long z; scanf("%lf",&x); double doubleMod =...
分类:其他好文   时间:2014-07-08 21:29:40    阅读次数:175
uva 12003 Array Transformer (块状数组)
大白书上的393页。 一直在原数组上乱搞。其实要用另外一个数组记录块。 原数组是不能变的。 注意好原数组和块数组的关系,细心一点处理边界。还是不难的。 #include #include #include #include #define maxn 300005 #define SIZE 600 using namespace std; int a[maxn]; ...
分类:其他好文   时间:2014-07-08 21:28:22    阅读次数:202
数据结构:链表的基本操作(创建,删除,插入,逆序,摧毁)
代码注释比较详细: #include #include using namespace std; struct Node{ int data; Node* next; }; Node* head = NULL; bool create() { head = (Node*)malloc(sizeof(Node)); if(NULL == head) return false;...
分类:其他好文   时间:2014-07-08 21:05:05    阅读次数:238
UVA - 669 Defragment
题意:简单说就是将第i个簇号放回i,求最少的步数 思路:只处理链形,和环形的情况,其他的可以不管,对于链形来说,只要倒置就行了,环形的找一个空闲的放一个,然后就是链形的情况了 #include #include #include #include #include using namespace std; const int MAXN = 10005; int culsters[M...
分类:其他好文   时间:2014-07-08 20:47:19    阅读次数:228
UVA - 1533 Moving Pegs
题意:首先给你空闲的位置,可以跳过几个来吃掉几个,求最短的吃完所有的,且最后一个回到开始指定的位置 思路:BFS+HASH判重,对于每个位置有六个方向,当然有的是不能走的,加上map的判重就可以了 #include #include #include #include #include #include using namespace std; const int MAXN =...
分类:其他好文   时间:2014-07-08 19:29:38    阅读次数:246
HDU 4770 Lights Against Dudely(暴力)
HDU 4770 Lights Against Dudely 题目链接 题意:给定灯,有一盏灯可以旋转,问最少几个灯可以照亮.的位置,并且不能照到# 思路:暴力求解,先枚举特殊的灯,再枚举正常的灯,要加剪枝,不然会TLE 代码: #include #include #include using namespace std; const int INF = 0x...
分类:其他好文   时间:2014-07-08 18:23:55    阅读次数:196
Codeforces 444C(线段树)
区间颜色不一致就更新到底,否则lazy标记 #include #include #include #include using namespace std; #define lc l,m,index<<1 #define rc m+1,r,index<<1|1 #define N 100005 #define ll __int64 struct node { bool same; ll c...
分类:其他好文   时间:2014-07-08 18:00:56    阅读次数:226
UVA - 434 Matty's Blocks
题意:给你正视和侧视图,求最多多少个,最少多少个 思路:贪心的思想,求最少的时候:因为可以想象着移动,所以我们统计每个视图不同高度的个数,然后计算,至于的话,就是每次拿正视图的高度去匹配侧视求最大 #include #include #include #include using namespace std; const int MAXN = 1000; int k; int vie...
分类:其他好文   时间:2014-07-08 17:30:56    阅读次数:149
HDU 4772 Zhuge Liang's Password(模拟水)
HDU 4772 Zhuge Liang's Password 题目链接 题意:给定两张牌,可以旋转后重叠,重合后相同数字最多的是密码,求密码 思路:直接模拟记录最大值即可 代码: #include #include #include using namespace std; const int N = 35; int n; int a[N][N], b[N]...
分类:其他好文   时间:2014-07-08 14:17:11    阅读次数:185
poj3295 Tautology , 计算表达式的值
给你一个表达式,其包含一些0,1变量和一些逻辑运算法,让你判断其是否为永真式。 计算表达式的常用两种方法:1、递归; 2、利用栈。 code(递归实现) #include #include #include #include #include using namespace std; char str[2000]; int pos; bool calc(int bi...
分类:其他好文   时间:2014-07-08 14:02:35    阅读次数:174
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!