poj 3913(水)】的更多相关文章

Description You have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. Because of pending patent issues we will not discuss in detail how the strings are generat…
题目链接:http://poj.org/problem?id=1269 #include<cstdio> #include<cstring> #include<cmath> #include<iostream> #include<algorithm> #include<queue> using namespace std; ; ; const int INF = 0x3f3f3f; ; const double PI = acos(-…
题目链接: http://poj.org/problem?id=3356 AGTC Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 13855   Accepted: 5263 Description Let x and y be two strings over some finite alphabet A. We would like to transform x into y allowing only operat…
Language: Default Bloxorz I Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 5443   Accepted: 1811 Description Little Tom loves playing games. One day he downloads a little computer game called 'Bloxorz' which makes him excited. It's a ga…
求组合数,dfs即可 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> #include<queue> using namespace std; int N,m,t; ],vis[]; void dfs(int st,int n) { int i; ) //已选择6个 { ; ;i<=N;i++) {…
题意: 有M个猪圈,每个猪圈里初始时有若干头猪.一开始所有猪圈都是关闭的.依次来了N个顾客,每个顾客分别会打开指定的几个猪圈,从中买若干头猪.每个顾客分别都有他能够买的数量的上限.每个顾客走后,他打开的那些猪圈中的猪,都可以被任意地调换到其它开着的猪圈里,然后所有猪圈重新关上.问总共最多能卖出多少头猪.(1 <= N <= 100, 1 <= M <= 1000) 解析: 因为是依次 所以对于当前第i个顾客 所对应的猪圈 向前 i - 1 个顾客种有对应这个猪圈的顾客的其它猪圈 就…
Machine Schedule Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 17457   Accepted: 7328 Description As we all know, machine scheduling is a very classical problem in computer science and has been studied for a very long history. Scheduli…
题意: 就是一个圈上有n个点,给出m对个点,这m对个点,每一对都有一条边,合理安排这些边在圈内或圈外,能否不相交 解析: 我手残 我手残 我手残 写一下情况 只能是一个在圈外 一个在圈内 即一个1一个0 #include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <cctype> #include…
The Hardest Problem Ever Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 24241   Accepted: 13227 Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever faced was keeping himself alive. In orde…
题意:给N,表示N个节点. 给半个邻接矩阵,本身到本身的距离是0,边是双向的.当两个节点之间没有直接的边连接的时候,用x表示. 问从第一个节点到其他所有节点至少花费的时间. 这题唯一的处理是处理邻接矩阵的时候处理先当作字符串读入,然后处理一下数据,变成数据格式. 最后是输出第一个节点到其他所有节点最短路的最大值. #include<stdio.h> #include<string.h> int n; ; ][]; ][]; ]; ]; void solve(int pos) { v…
#include<stdio.h> #include<string.h> #define N 1100000 int isprim[N],prime[N]; void isprime() { int i,j; memset(isprim,-1,sizeof(isprim)); isprim[1]=0; for(i=2;i<=1000;i++) if(isprim[i]==-1) { for(j=i*2;j<=1000000;j+=i) isprim[j]=0; } }…
5分钟写完 水水更开心 //By SiriusRen #include <cstdio> #include <iostream> #include <algorithm> using namespace std; int m,t,u,f,d; char jy; int main(){ scanf("%d%d%d%d%d",&m,&t,&u,&f,&d); for(int i=1;i<=t;i++){ ci…
题意:给定一个由字符组成的矩阵,求出它的面积最小的覆盖矩阵.(感觉应该是可重叠的......* (・ω・)っ) 解法:KMP.行列互不影响,可以问题分解.先求出每一行的最小重复串,利用kmp中的next[ ]数组,然后求其最小公倍数.若变成最大值就可以break了,这也是我代码本来应该O(2*m*n),但却32ms很快的原因......(๑•ᴗ•๑) 于是同样地求每一列的最小重复串,再求最小公倍数.最终2个答案相乘就行了. P.S.这题我十分纠结,也有人说poj数据水......但我还是AC了~…
Speed Limit Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 17967   Accepted: 12596 Description Bill and Ted are taking a road trip. But the odometer in their car is broken, so they don't know how many miles they have driven. Fortunately…
题目 以前做过的一道题, 今天又加了一种方法 整理了一下..... 题意:给出一个字符串,问要将这个字符串变成回文串要添加最少几个字符. 方法一: 将该字符串与其反转求一次LCS,然后所求就是n减去 最长公共子串的长度. 额,,这个思路还是不是很好想. LCS: #include<iostream> #include<cstring> #include<cstdio> using namespace std; +; char s1[maxn], s2[maxn]; ][…
题目地址:POJ 2115 水题. . 公式非常好推.最直接的公式就是a+n*c==b+m*2^k.然后能够变形为模线性方程的样子,就是 n*c+m*2^k==b-a.即求n*c==(b-a)mod(2^k)的最小解.(真搞不懂为什么训练的时候好多人把青蛙的约会都给做出来了,这题却一直做不出来.. . . . 这两道不都是推公式然后变形吗. .... ) 代码例如以下: #include <iostream> #include <cstdio> #include <strin…
[题目链接] $O(n^2)$ 效率的 dp 递推式:${ dp }_{ i }=min\left( dp_{ j }+\overset { i }{ \underset { x=j+1 }{ max }  } \left( { a }_{ x } \right)  \right) $,其中 $\sum _{ x=j+1 }^{ i }{ { a }_{ i } } \le m$. 尝试着换一个角度看待这个问题,有一个序列 $a$,假设 $b_i$ 表示 $i$ 最左能扩展到 $b_i$ 位置,…
题解: 和bzoj1367差不多 然后a[i]-i不用加 然后我再另一个地方加了这句话 然后poj ac,bzoj wa poj数据水啊 代码: #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> using namespace std; ; long long ans,ans1,ans2; ],dist[N],val[N],tot,size[N],n,a[N],l[N…
做这道题的动机就是想练习一下堆的应用,顺便补一下好久没看的图论算法. Dijkstra算法概述 //从0出发的单源最短路 dis[][] = {INF} ReadMap(dis); for i = 0 -> n - 1 d[i] = dis[0][i] while u = GetNearest(1 .. n - 1, !been[]) been[u] = 1 for_each edge from u d[edge.v] = min(d[edge.v], d[u] + dis[u][edge.v]…
POJ 1488 题目大意:给定一篇文章,将它的左引号转成 ``(1的左边),右引号转成 ''(两个 ' ) 解题思路:水题,设置一个bool变量标记是左引号还是右引号即可 /* POJ 1488 Tex Quotes --- 水题 */ #include <cstdio> #include <cstring> int main() { #ifdef _LOCAL freopen("D:\\input.txt", "r", stdin); #…
POJ 3176 Cow Bowling 链接: http://poj.org/problem?id=3176 这道题可以算是dp入门吧.可以用一个二维数组从下向上来搜索从而得到最大值. 优化之后可以直接用一维数组来存.(PS 用一维的时候要好好想想具体应该怎么存,还是有技巧的) #include<iostream> #include<cstring> #include<cmath> #include<cstdio> using namespace std;…
题目:http://poj.org/problem?id=3080 水题,暴搜 #include <iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<stack> #include<queue> #include<iomanip> #include<cmath> #include<map> #include…
转载请注明出处:優YoU http://blog.csdn.net/lyy289065406/article/details/6642573 部分解题报告添加新内容,除了原有的"大致题意"和"解题思路"外, 新增"Source修正",因为原Source较模糊,这是为了帮助某些狂WA的同学找到测试数据库,但是我不希望大家利用测试数据打表刷题 ­­ ­ 推荐文:1.一位ACMer过来人的心得 2. POJ测试数据合集 OJ上的一些水题(可用来练手和增…
题目链接:http://poj.org/problem?id=3984 Description 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, }; 它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线. Input 一个5 × 5的二维数组,表示一个迷宫.数据保证有…
题目链接:http://poj.org/problem?id=3254 Time Limit: 2000MS Memory Limit: 65536K Description Farmer John has purchased a lush new rectangular pasture composed of M by N (1 ≤ M ≤ 12; 1 ≤ N ≤ 12) square parcels. He wants to grow some yummy corn for the cows…
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight Moves1101 Gamblers1204 Additive equations 1221 Risk1230 Legendary Pokemon1249 Pushing Boxes 1364 Machine Schedule1368 BOAT1406 Jungle Roads1411 Annive…
LINK 题意:给出一个简单多边形,按极角序输出其坐标. 思路:水题.对任意两点求叉积正负判断相对位置,为0则按长度排序 /** @Date : 2017-07-13 16:46:17 * @FileName: POJ 2007 凸包极角序.cpp * @Platform: Windows * @Author : Lweleth (SoungEarlf@gmail.com) * @Link : https://github.com/ * @Version : $Id$ */ #include <…
POJ.1003 Hangover ( 水 ) 代码总览 #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <queue> #include <stack> #include <vector> #define nmax using namespace std; vector <double> v…
POJ. 1005 I Think I Need a Houseboat(水 ) 代码总览 #include <cstdio> #include <cstring> #include <cmath> #include <queue> #include <stack> #include <vector> #define nmax using namespace std; const double pi = acos(-1); int m…
POJ.2739 Sum of Consecutive Prime Numbers(水) 代码总览 #include <cstdio> #include <cstring> #include <vector> #include <cmath> #define nmax 10005 using namespace std; int prime[nmax],n; vector<int> vprime; void init() { memset(pri…