Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 103896   Accepted: 50542 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 a…
实在太冷了今天 taxi :错误原因1 忽略了 1 1 1 1 和 1 2 1 这种情况,直接认为最多两组一车了 2 语句顺序错 double cola: 忘了减去n的序号1,即n-- B. Taxi time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output After the lessons n groups of schoolchi…
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…
Help Me with the Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3510   Accepted: 2251 Description Your task is to read a picture of a chessboard position and print it in the chess notation. Input The input consists of an ASCII-art…
Emag eht htiw Em Pleh Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2806   Accepted: 1865 Description This problem is a reverse case of the problem 2996. You are given the output of the problem H and your task is to find the correspond…
487-3279 Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 247781   Accepted: 44015 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…
Borg Maze Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8905   Accepted: 2969 Description The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to descr…
Highways Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 23033   Accepted: 10612 Description The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Fl…
链接地址: Poj:http://poj.org/problem?id=1003 OpenJudge:http://bailian.openjudge.cn/practice/1003 题目: Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 94993   Accepted: 46025 Description How far can you make a stack of cards overhang…
    Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 95164   Accepted: 46128 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'r…
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…
题目链接:http://poj.org/problem?id=2262 哥德巴赫猜想肯定是正确的 思路: 筛出n范围内的所有奇质数,对每组数据试过一遍即可, 为满足b-a取最大,a取最小 时空复杂度分析: 在1e6内约有8e4个奇质数,因为a <= b,时间复杂度在T*4e4+1e6等级.一般T为1e3,足以承受 空间复杂度为1e6,足以承受 #include <cstdio> #include <cstring> #include <algorithm> usi…
一. 题目 Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 116593   Accepted: 56886 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. (W…
#include <iostream> using namespace std; int main() { double len; while(cin >> len && len) { double sum = 0.0; double i = 1.0; ; while(sum < len) { sum += i/n; ++n; } cout << n- << " card(s)" <<endl; } ;…
103. Traffic Lights Time limit per test: 0.25 second(s)Memory limit: 4096 kilobytes input: standardoutput: standard In the city of Dingilville the traffic is arranged in an unusual way. There are junctions and roads connecting the junctions. There is…
http://poj.org/problem?id=2253 #include <iostream> #include <queue> #include <cmath> #include <iomanip> using namespace std; queue <int > que; int co[202][2]; double d[202][202],u[202][202]; int n; int main(){ ios::sync_with_…
http://poj.org/problem?id=2632 #include<cstdio> #include <cstring> #include <algorithm> using namespace std; int A,B,n,m; int robot[101][3]; char rbuff[10]; int dir[255]; const int dx[4]={0,1,0,-1}; const int dy[4]={1,0,-1,0}; int action…
题目链接:http://poj.org/problem?id=1503 import java.io.*; import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String []args) throws IOException{ Scanner scanner=new Scanner(System.in); BigInteger a=BigIntege…
http://poj.org/problem?id=1083 这道题题意是有若干段线段,每次要求线段不重叠地取,问最少取多少次. 因为这些线段都是必须取的,所以需要让空隙最小 思路: 循环直到线段全部取完,对于某个刚取得线段ij,下一个线段km取起点k尽量靠近j且满足k>j的.记录循环次数cnt,答案是cnt*10 注意: 房间是相对的,也就是说对于奇数房间号,利用的走廊相当于对应的偶数房间号开始的那一段路程, 一段路程的开头不能是另外一段路程的结尾. #include <cstdio>…
题目 http://poj.org/problem?id=1035 题意 字典匹配,单词表共有1e4个单词,单词长度小于15,需要对最多50个单词进行匹配.在匹配时,如果直接匹配可以找到待匹配串,则直接输出正确信息,否则输出所有满足以下条件的单词: 1. 待匹配串删除任意一个字符后可以匹配的 2. 单词删除任意一个字符后可以匹配的 3. 把待匹配串中某个字符改为单词对应字符后可以匹配的 思路由于单词表容量较小,直接匹配可以直接使用strcmp进行.若直接匹配不成功,那么需要对每个单词进行再次比较…
http://poj.org/problem?id=3984 典型的迷宫问题,记录最快到达某个点的是哪个点即可 #include <cstdio> #include <cstring> #include <queue> using namespace std; const int maxn=10; const int inf=0x3fffffff; struct pnt { int x,y; pnt(){x=y=0;} pnt(int tx,int ty){x=tx,y…
http://poj.org/problem?id=2251 bfs,把两维换成三维,但是30*30*30=9e3的空间时间复杂度仍然足以承受 #include <cstdio> #include <cstring> #include <algorithm> #include <queue> using namespace std; struct P{ int x,y,z; P(){x=y=z=0;} P(int x,int y,int z){ this-&…
http://poj.org/problem?id=1321 注意是在'#'的地方放棋子 矩阵大小不过8*8,即使是8!的时间复杂度也足以承受,可以直接dfs求解 dfs时标注当前点的行和列已被访问,接着搜索行列都未被访问的新点,注意搜索完毕之后标注当前点的行和列未被访问 #include <cstdio> #include <cstring> using namespace std; int n,k; char maz[8][9]; int e[8][8],len[8]; boo…
#define ONLINE_JUDGE #include<cstdio> #include <cstring> #include <algorithm> using namespace std; int A,B,sx,sy; char maz[101][101]; int vis[101][101]; const int dx[4]={0,1,0,-1}; const int dy[4]={-1,0,1,0}; int dir(char ch){ if(ch=='N'…
The Triangle Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 37931   Accepted: 22779 Description 73 88 1 02 7 4 44 5 2 6 5 (Figure 1) Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on…
Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 109231   Accepted: 53249 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 a…
点击打开链接 题目大意 就是有很多卡片可以沿着桌边向外放,每次可以伸出1/2,1/3,1/4问最少多少卡片才能让一张完成的卡片悬空,题目输入卡片的宽度,输出卡片个数 #include<stdio.h> int array[550]; int main() { int i, j; double sum = 0; array[0] = 0; for(i = 1, j = 1; j < 521; i++) { sum += 1.0/(i + 1); int n = sum * 100; for…
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 assuming that the cards must be perpendicular to the table.) With two cards you can make the top card overha…
BUPT 2017 summer training (16) #2C 题意 n个卡片可以支撑住的长度是1/2+1/3+1/4+..+1/(n+1)个卡片长度.现在给出需要达到总长度,求最小的n. 题解 模拟加起来,直到长度不小于给定的总长度. 我也写了个java代码^_^ 代码 import java.util.*; import java.io.*; public class Main{ public static void main(String []args){ Scanner cin =…
115. Calendar time limit per test: 0.25 sec. memory limit per test: 4096 KB First year of new millenium is gone away. In commemoration of it write a program that finds the name of the day of the week for any date in 2001. Input Input is a line with t…