模拟
Loi_whales
生活不止眼前的苟且,还有诗和远方的田野
展开
-
openjudge每日推荐——7620区间合并
描述 给定 n 个闭区间 [ai; bi],其中i=1,2,…,n。任意两个相邻或相交的闭区间可以合并为一个闭区间。例如,[1;2] 和 [2;3] 可以合并为 [1;3],[1;3] 和 [2;4] 可以合并为 [1;4],但是[1;2] 和 [3;4] 不可以合并。 我们的任务是判断这些区间是否可以最终合并为一个闭区间,如果可以,将这个闭区间输出,否则输出no。 输入 第原创 2016-10-21 19:55:45 · 485 阅读 · 0 评论 -
poj1002 487-3279
题目大意:就是给你一些符号和大写字母对应的数字,要求全部转化成电话号码XXX-XXXX的形式,其中X只能是数字,这些字符串的长度不等,里面会有一些‘-’,最后要求是找出出现次数>1的电话号码,输出号码和重复出现的次数,如果没有重复的号码,就输出:“No duplicates.” WA的同学注意“No duplicates.”不要漏掉“.”。 TLE的同学注意把cin和cout改成scanf和pr原创 2017-10-12 20:59:00 · 227 阅读 · 0 评论 -
poj 3069 Saruman's Army
题目大意就不说了 方法是:先排序,然后从第一个点开始往右R个长度看看能覆盖多少点,再从最远能覆盖到的点P开始继续往右R个单位长度,这是点P能覆盖的范围,找到所有这些点做标记,就是最少能标记的点 具体实现如下:#include <cstdio> #include <iostream> #include <algorithm> #include <cstring> using namespace s原创 2017-10-11 08:24:32 · 222 阅读 · 0 评论 -
poj 2709 Painter
题目翻译: 杂货店出售一种由 N(3<=N<=12)种不同颜色的颜料,每种一瓶(50ML), 组成的颜料套装。你现在需要使用这 N 种颜料;不但如此,你还需要一定 数量的灰色颜料。杂货店从来不出售灰色颜料——也就是它不属于这 N 种 之一。幸运的是,灰色颜料是比较好配置的,如果你取出三种不同颜色的 颜料各 x ml,混合起来就可以得到 xml 的灰色颜料(注意不是 3x原创 2017-10-10 16:27:21 · 228 阅读 · 0 评论 -
poj1852 Ants
这题考察思维的灵活性,此外这份代码用cin和cout会超时(orz)#include <cstdio> #include <cstring> #include <algorithm> #include <iostream> #include <cmath> using namespace std; int a[1000000]; int ans[1000000]; int main() {原创 2017-10-10 19:20:57 · 207 阅读 · 0 评论 -
POJ3617 Best Cow Line
注意最后输出的时候每80个就要换一次行(PE两次后的教训之认真看题)#include <cstdio> #include <iostream> #include <algorithm> #include <cstring> using namespace std; int n; char s[20000],T[20000]; int main() { scanf("%d",&n);原创 2017-10-10 21:23:06 · 244 阅读 · 0 评论 -
NOIP前夕模板整理第二弹:数据结构
1、并查集 例题:家族 然而其实并查集的用处还有很多#include <cstdio> #include <iostream> #include <algorithm> #include <cstring> using namespace std; int fa[100000]; int find(int x) { return fa[x] == x?x:fa[x] = find(fa[原创 2016-11-13 21:51:39 · 381 阅读 · 0 评论 -
NOIP2012Vigenère密码
刚开始写,先放点以前的题目和最近的模拟题 题目描述 16世纪法国外交家Blaise de Vigenère设计了一种多表密码加密算法——Vigenère密码。Vigenère密码的加密解密算法简单易用,且破译难度比较高,曾在美国南北战争中为南军所广泛使用。 在密码学中,我们称需要加密的信息为明文,用M表示;称加密后的信息为密文,用C表示;而密钥是一种参数,是将明文转换为密文或将密文转原创 2016-10-20 21:55:26 · 550 阅读 · 0 评论 -
Codeforces Round #378 (Div. 2)A题
A. Grasshopper And the String One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in原创 2016-11-11 11:34:21 · 338 阅读 · 1 评论 -
codevs1384黑色星期五【USACO】
题目描述 Description 13号又是星期五是一个不寻常的日子吗? 13号在星期五比在其他日少吗?为了回答这个问题,写一个程序来计算在n年里13 日落在星期一,星期二……星期日的次数.这个测试从1900年1月1日到 1900+n-1年12月31日.n是一个非负数且不大于400. 这里有一些你要知道的:1900年1月1日是星期一. 4,6,11和9月有30天.其他月份除了2月有31天.原创 2016-11-11 10:51:16 · 673 阅读 · 0 评论 -
openjudge约瑟夫问题
听说这是个用链表做,然而。。。。#include <cstdio> #include <iostream> #include <cstring> using namespace std; int n,m;struct po { int pre,next,x; }a[2333]; int main() { while(scanf("%d%d",&n,&m)) {原创 2016-10-29 07:00:31 · 498 阅读 · 0 评论 -
noip2015day1 T1神奇的幻方
直接放代码吧,以前写的,十分暴力#include <cstdio> #include <iostream> #include <cstring> #include <algorithm> using namespace std; int w[100][100]; int main() { int n; scanf("%d",&n); w[1][n/2+1] = 1;原创 2016-11-09 21:23:30 · 370 阅读 · 0 评论 -
poj1007 DNA Sorting
题意是给你一些DNA序列,让你计算每个序列里某个字母后面有多少个比它小的字母,加起来作为一个参数(就是求逆序数),然后按照这个参数从小到大的顺序排列这些DNA序列并输出,如果大小相等,按原来顺序输出。 按题意模拟就好(表示看错题意WA了好多次T_T)#include <cstdio> #include <iostream> #include <algorithm> #include <cstrin原创 2017-10-13 09:01:57 · 278 阅读 · 0 评论