Problem E The Longest Straight Accept: 71    Submit: 293 Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Description ZB is playing a card game where the goal is to make straights. Each card in the deck has a number between 1 and M(including…
Problem 2216 The Longest Straight Accept: 17    Submit: 39Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description ZB is playing a card game where the goal is to make straights. Each card in the deck has a number between 1 and M(includin…
 Problem 2216 The Longest Straight Accept: 7    Submit: 14 Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description ZB is playing a card game where the goal is to make straights. Each card in the deck has a number between 1 and M(includi…
题目大意:给n个0~m之间的数,如果是0,那么0可以变为任意的一个1~m之间的一个数.从中选出若干个数,使构成一个连续的序列.问能构成的最长序列的长度为多少? 题目分析:枚举连续序列的起点,二分枚举二分序列的终点. 代码如下; # include<iostream> # include<cstdio> # include<queue> # include<vector> # include<list> # include<map> #…
 Problem 2216 The Longest Straight Accept: 82    Submit: 203Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description ZB is playing a card game where the goal is to make straights. Each card in the deck has a number between 1 and M(includ…
 Problem 2216 The Longest Straight Accept: 523    Submit: 1663Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description ZB is playing a card game where the goal is to make straights. Each card in the deck has a number between 1 and M(incl…
Description 题目描述 ZB is playing a card game where the goal is to make straights. Each card in the deck has a number between 1 and M(including 1 and M). A straight is a sequence of cards with consecutive values. Values do not wrap around, so 1 does not…
题目链接:The Longest Straight 就是一个模拟就是这样,T_T然而当时恶心的敲了好久,敲完就WA了,竟然有这么简单的方法,真是感动哭了.......xintengziji...zhishang... 模拟和暴力也都是有黑科技的.. 附黑科技代码: #include<stdio.h> #include<queue> #include<iostream> #include<string.h> #include<algorithm>…
http://acm.fzu.edu.cn/problem.php?pid=2271 [题意] 给定一个n个点和m条边的无向连通图,问最多可以删去多少条边,使得每两个点之间的距离(最短路长度)不变. [思路] 首先对于多重边可以只保留最短的边,剩下的都删去 跑一次Floyd,用vis数组记录哪些边可以被松弛(注意map[i][k]+map[k][j]==map[i][j]时,i-j这条边如果在原图,也可以被删去) 最后遍历一下所有的原图的边,可以被松弛的就可以被删去 [Accepted] #in…
The following iterative sequence is defined for the set of positive integers: n n/2 (n is even) n 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 40 20 10 5 16 8 4 2 1 It can be seen that this seque…