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

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…
题目链接: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(-…
求组合数,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++) {…
#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…
以下是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…
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的二维数组,表示一个迷宫.数据保证有…
    A+B Problem Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 311263   Accepted: 171333 Description Calculate a+b Input Two integer a,b (0<=a,b<=10) Output Output a+b   Sample Input 1 2 Sample Output 3 计算两个整数的和 解决思路 这是经典水题了,每个OJ必有的.题目…
http://poj.org/problem?id=3461 直接KMP就好.水题 #include<cstdio> #include<cstring> const int MAXN=10000+10; const int MAXM=1000000+10; char P[MAXN],T[MAXM]; int f[MAXN],n,m,ans; void getFail() { f[0]=f[1]=0; for(int i=1;i<n;i++){ int j = f[i]; wh…
DNA Sorting Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 80832   Accepted: 32533 Description One measure of ``unsortedness'' in a sequence is the number of pairs of entries that are out of order with respect to each other. For instanc…
Biorhythms Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 110991   Accepted: 34541 Description Some people believe that there are three cycles in a person's life that start the day he or she is born. These three cycles are the physical,…
487-3279 Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 236746   Accepted: 41288 Description Businesses like to have memorable telephone numbers. One way to make a telephone number memorable is to have it spell a memorable word or phras…
Financial Management Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 126087   Accepted: 55836 Description Larry graduated this year and finally has a job. He's making a lot of money, but somehow never seems to have enough. Larry has deci…
Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 99450   Accepted: 48213 Description How far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We're as…
I Think I Need a Houseboat Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 85149   Accepted: 36857 Description Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land,…
题意:找到一段数字里最大值和最小值的差 水题 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> #include<queue> using namespace std; ; const int INF=0x3f3f3f3f; int n,m,t; ; ],dpMIN[MAXN][]; int mm[MAXN…
题意:给定一个金字塔,第 i 行有 i 个数,从最上面走下来,只能相邻的层数,问你最大的和. 析:真是水题,学过DP的都会,就不说了. 代码如下: #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostream> #include <cstring> #include <set> #include <…
#include <iostream> using namespace std; /*248K 32MS*/ int main() { int s,d; while(cin>>s>>d) { int count=0; for(int i=5;i>0;i--) { if(s*i<(5-i)*d) { count=i; break; } } int total=s*count-d*(5-count); total*=2; if(count>=2) tota…
一.Description As part of an arithmetic competency program, your students will be given randomly generated lists of from 2 to 15 unique positive integers and asked to determine how many items in each list are twice some other item in the same list. Yo…
一.Description Suppose you are reading byte streams from any device, representing IP addresses. Your task is to convert a 32 characters long sequence of '1s' and '0s' (bits) to a dotted decimal format. A dotted decimal format for an IP address is form…
一.Description Eva的家庭作业里有很多数列填空练习.填空练习的要求是:已知数列的前四项,填出第五项.因为已经知道这些数列只可能是等差或等比数列,她决定写一个程序来完成这些练习. Input 第一行是数列的数目t(0 <= t <= 20).以下每行均包含四个整数,表示数列的前四项.约定数列的前五项均为不大于10^5的自然数,等比数列的比值也是自然数. Output 对输入的每个数列,输出它的前五项. 二.题解      又是水题啊,感觉不能这样下去了,不然我自己也变水了. 三.j…
一.Description The king pays his loyal knight in gold coins. On the first day of his service, the knight receives one gold coin. On each of the next two days (the second and third days of service), the knight receives two gold coins. On each of the ne…
id=1269" rel="nofollow">Intersecting Lines 大意:给你两条直线的坐标,推断两条直线是否共线.平行.相交.若相交.求出交点. 思路:线段相交推断.求交点的水题.没什么好说的. struct Point{ double x, y; } ; struct Line{ Point a, b; } A, B; double xmult(Point p1, Point p2, Point p) { return (p1.x-p.x)*(p2…
A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 135904   Accepted: 42113 Case Time Limit: 2000MS Description You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type o…
Prime Gap 这里直接写中文了 Descriptions: 对于一个数n,若n为素数则输出0,否则找到距离n最小的两个素数,一个大于n,一个小于n,输出他们的差(正数) Input 多组输入 每行包含一个数n 若n为0,程序结束 Output 对于每个测试数据,输出一个答案占一行 Sample Input 10 11 27 2 492170 0 Sample Output 4 0 6 0 114 题目链接: https://vjudge.net/problem/UVA-1644 水题,先求…
Flow Layout Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 3091   Accepted: 2148 Description A flow layout manager takes rectangular objects and places them in a rectangular window from left to right. If there isn't enough room in one r…