oj题目
void_id:)
梦想走天涯,因为太胖放弃了计划。
展开
-
hi
指针无限弟归: 弟弟弟...弟弟_{弟_{弟..._{弟}}}弟弟弟...弟本人水平有限,写这篇文章的时候有时候我自己有不是整太明白希望大家带着批判的眼光看有什么错误欢迎大家指出或与我讨论一、指针和指针变量指针就是地址指针就是地址,地址就是指针一个数据对象的内存地址称为该数据对象的指针此处的地址不是机器的物理地址,而是虚拟地址指针变量就是存放指针的变量int a...原创 2019-11-30 10:10:39 · 212 阅读 · 0 评论 -
市赛(天亡发际线队)
Problem A. dsy’s repeater#include<iostream>#include<string>using namespace std;int main(){ int a,b; cin >> a >> b; for(int i = 1;i <= a;i++){ string...原创 2019-04-22 22:43:48 · 131 阅读 · 0 评论 -
Dijkstra模板
#include<bits/stdc++.h>using namespace std;const int maxn = 100050;const int INF = 0x3f3f3f3f3f3f3f3f;int n, m;struct Edge { int from, to, dist; Edge(int f, int t, int d) :from(f), to(t...原创 2019-07-30 08:13:16 · 75 阅读 · 0 评论 -
银联 第二场 (本弟弟只会做水题
A码队GO(找最大正方形)代码:#include<bits/stdc++.h>using namespace std;int main(){ int T,n,m; cin >> T; while(T--){ cin >> n >> m; char tmp; int mat[n+2][m+2] = { 0 }; int ...原创 2019-07-22 09:51:07 · 80 阅读 · 1 评论 -
dp水题
HDU-1087是一个O(N²)的dp具体见代码,注意要用long long#include<bits/stdc++.h>#define int long longusing namespace std;int res[1010];int A[1010];signed main() { int n; while (scanf("%lld", &n) &a...原创 2019-09-23 23:24:08 · 96 阅读 · 0 评论 -
训练十二
训练十二题目链接A.Valya and Letter题意,给一个信的长宽,和信箱口的长宽,每次可以对折,问最少多少次能把信放进去。#include<bits/stdc++.h>using namespace std;long long n, m, a, b;int main() { scanf("%lld%lld%lld%lld", &n, &m, ...原创 2019-10-04 16:52:03 · 129 阅读 · 0 评论 -
汉诺塔递归
汉诺塔#include<bits/stdc++.h>using namespace std;int cnt = 0;struct Node { int n, from, tmp, to;};stack<Node>stk;void move(int from, int to) { //cout << from << "->...原创 2019-10-05 10:00:20 · 90 阅读 · 0 评论 -
汉诺塔游戏,可以玩
用了easyx写了一个汉诺塔的实现过程,还挺好玩的#include<bits/stdc++.h>#include<graphics.h>#include<Windows.h>#include<conio.h>using namespace std;vector<int>p[3];void draw_rec() ...原创 2019-10-05 11:45:42 · 386 阅读 · 1 评论 -
C.How_to_Fail_at_Programming_Contest
title: C.How_to_Fail_at_Programming_Contestdate: 2019-10-05 22:20:11categories:ACMtags:背包基础dp最近比赛碰到了一道背包问题,大意就是在背包尽可能装的多的情况下获取最小价值。给????整蒙⚪了。我就决定复习一下背包问题。首先,回顾一下01背包和完全背包的转移方程01背包状态转移方程: ...原创 2019-10-05 22:21:34 · 188 阅读 · 0 评论 -
训练十三
题目Problem A Secret of Chocolate Poles题意就是有高度为1的黑块和白块,还有高度为k的黑块,要求底层和顶层都是黑色,问高度不超过h的所有摆放可能的方法思路: 动态规划进行状态转移.用dp[i][j] 来表示高度为i,顶层颜色为j时候的摆放方案数,j 为 0 代表白色,j 为 1代表 黑色#include<bits/stdc++.h>us...原创 2019-10-06 20:43:31 · 123 阅读 · 0 评论 -
UVA 816 (写的全是bug,手动呲牙)
bfs失败。mark#include<iostream>#include<vector>#include<cstring>#include<queue>using namespace std;const int N = 15;int r1, c1, dir;int end_r, end_c;char title[1000];co...原创 2019-04-09 23:23:39 · 121 阅读 · 0 评论 -
二分图的最小点集覆盖
学习链接:https://blog.csdn.net/dark_scope/article/details/8880547这篇比较简单易懂学习链接:https://www.cnblogs.com/wangjunyan/p/5563154.html这篇更详细一些学习链接:https://www.cnblogs.com/shenben/p/5573788.html例题:https://vju...原创 2019-04-13 11:09:01 · 185 阅读 · 3 评论 -
拓扑排序
一,利用dfs进行拓扑排序#include<iostream>using namespace std;/*----------------------------------------------代码比较乱,大概就是c[]数组表示状态,-1表示正在dfs,1表示已经dfs完毕,0表示未访问for (遍历所有节点v){ if(!c[v] && !dfs(v...原创 2019-04-12 15:29:48 · 136 阅读 · 1 评论 -
7-1 正整数A+B (15 分)
我又来水题了/cy7-1 正整数A+B (15 分)题的目标很简单,就是求两个正整数A和B的和,其中A和B都在区间[1,1000]。稍微有点麻烦的是,输入并不保证是两个正整数。输入格式:输入在一行给出A和B,其间以空格分开。问题是A和B不一定是满足要求的正整数,有时候可能是超出范围的数字、负数、带小数点的实数、甚至是一堆乱码。注意:我们把输入中出现的第1个空格认为是A和B的分隔。题目保证...原创 2019-03-26 22:50:03 · 1736 阅读 · 4 评论 -
7-4 判断素数 (10 分)(疯狂水题)
7-4 判断素数 (10 分)本题的目标很简单,就是判断一个给定的正整数是否素数。输入格式:输入在第一行给出一个正整数N(≤ 10),随后N行,每行给出一个小于231 的需要判断的正整数。输出格式:对每个需要判断的正整数,如果它是素数,则在一行中输出Yes,否则输出No。输入样例:211111输出样例:YesNo#include<iostream>...原创 2019-03-26 23:00:14 · 4028 阅读 · 2 评论 -
6-6 CheckBST[1] (30 分)
6-6 CheckBST[1] (30 分)Sample Input 1: (for the following tree)4Sample Output 1:Yes. Key = 5Sample Input 2: (for the following tree)3Sample Output 2:No. Height = 3误区:判断BST要用中序遍历,看是否递增。而不能...原创 2019-04-01 12:49:06 · 1414 阅读 · 0 评论