
模拟
wanherun
今天会有好事发生吗
展开
-
bzoj2760 [JLOI2011]小A的烦恼
题目大模拟题,这种题就是要细心才行,比如noip2017的d1t2就是这样的,没什么难度。对于这道题,可以用STL来优化,这也不失为一种好办法来加快代码速度。STL就是要多练。#include<bits/stdc++.h>#define N 1000using namespace std;int total,m;string ans[N+5],name;int cnt[N+5];int原创 2017-12-08 11:34:59 · 555 阅读 · 0 评论 -
bzoj1028 [JSOI2007]麻将
题目作为一个优秀中学生,当然是不打麻将的呢233。看一看题目描述,熟悉一下规则吧。作为bzoj中的一道题,枚举也是需要思考的233。 先枚举听的牌,再枚举对子,剩下的看能不能全凑成顺子。#include<bits/stdc++.h>#define N 500using namespace std;int n,m;int cnt[N+1],x;int ans[N+1],len,tmp[N+原创 2017-08-31 07:38:48 · 313 阅读 · 0 评论 -
bzoj1411 [ZJOI2009]硬币游戏
题目我们可以先用O(mn)的模来做一做,之后可以发现每过2^k次方后,每个硬币都有规律的,我们就可以这样相当于拆一下二进制就可以了。细节还是比较多的。#include<bits/stdc++.h>#define N 100000using namespace std;long long n;int A[2*N+1];int B[2*N+1];long long T;int main()原创 2017-09-06 21:52:01 · 349 阅读 · 1 评论 -
bzoj1088 [SCOI2005]扫雷Mine
题目扫雷这种东西233对于这道题,只要第一格的雷确定了,之后都确定了,再判定是否合理加进答案就好了。#include<bits/stdc++.h>#define N 10000using namespace std;int n;int A[N+1];int f[N+1];int Ans=0;int main(){ scanf("%d",&n); for(registe原创 2017-09-07 14:24:43 · 230 阅读 · 0 评论 -
bzoj2761 [JLOI2011]不重复数字
题目简单题。。。注意输出格式。 一个空格都不能多2333#include<bits/stdc++.h>#define N 50000#define mod 1587991using namespace std;int n,T;int x;set <int> E;int main(){ //freopen("in.txt","r",stdin); scanf("%d"原创 2017-09-08 22:30:55 · 182 阅读 · 0 评论 -
bzoj1033 [ZJOI2008]杀蚂蚁antbuster
题目zjoi。。。一道神题,大模拟题目。不想写233。贴一个hzwer的代码。#include<cstdio>#include<iostream>#include<cstring>#include<cmath>#include<algorithm>using namespace std;int n,m,s,tur_d,r,T,born;int in[11][11];int xx[4]原创 2017-09-10 19:34:41 · 387 阅读 · 1 评论 -
bzoj4291 [PA2015]Kieszonkowe
题目水题,几个变量就OK了。如果和为偶数,输出,否则减去最小奇数,输出。若答案为0,输出无解。#include<bits/stdc++.h>using namespace std;int n,x,tot;int mn;inline char nc(){ static char buf[100000],*p1=buf,*p2=buf; return p1==p2&&(p2=(原创 2017-09-26 22:58:56 · 219 阅读 · 0 评论 -
bzoj1610 [Usaco2008 Feb]Line连线游戏
题目给定n个点,问它们两两构成的直线中,斜率的不同值有几种。。。n<=200。。。大水题,只要注意斜率不存在的情况就好了。#include<bits/stdc++.h>#define inf 1e20#define eps 1e-8#define N 200using namespace std;int n,tot,ans;int x[N+5],y[N+5];double f[N*N+原创 2017-10-08 18:57:25 · 217 阅读 · 0 评论 -
bzoj3403 [Usaco2009 Open]Cow Line 直线上的牛
题目双端队列233。把队列开两倍,l与r放在中间就好了。#include<bits/stdc++.h>#define N 100000 using namespace std;int n,cnt,x;int Q[N*2+5],l,r;char opt1,opt2;inline char nc(){ static char buf[100000],*p1=buf,*p2=buf;原创 2017-10-10 22:54:58 · 275 阅读 · 0 评论 -
bzoj1753 [Usaco2005 qua]Who's in the Middle
题目深夜水题第三弹,中位数,sort就行。。#include<bits/stdc++.h>using namespace std;int n,A[100005];inline char nc(){ static char buf[100000],*p1=buf,*p2=buf; return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,st原创 2017-10-17 23:41:14 · 216 阅读 · 0 评论 -
[noip2016]玩具谜题 题解
D1T1,签到题,也是一道简单的模拟题。会条件结构和循环就行了。显然,每次是往顺时针或逆时针来转,仔细观察可以发现,如果方向与左右手相同的话,就是加,不然就是减。这样代码会短很多。#include<bits/stdc++.h>#define N 100000using namespace std;int n,dir[N+5],tmp,s,m;int pos;char name[N+5][1原创 2017-10-19 23:57:28 · 689 阅读 · 2 评论 -
[noip2015]神奇的幻方 题解
模拟题目,按照要求填就好了。而且这种题目十分好查错,应该是比较稳的题。#include<bits/stdc++.h>int n,f[50][50],x,y,xx,yy;using namespace std;int main(){ cin>>n; x=1,y=n/2+1; for(int i=1;i<=n*n;i++) { f[x][y]=i;原创 2017-10-22 17:15:22 · 899 阅读 · 0 评论 -
[noip2014]生活大爆炸版石头剪刀布 题解
D1T1想当然的模拟了。不过为了方便起见,我们可以先手动算一个f数组,这样的话,在比较的时候会异常简单。这可是一个非常有用的技巧。#include<bits/stdc++.h>using namespace std;int n,na,nb,x,y;int a[205],b[205];int fa,fb;const int f[5][5]={ 0,-1,1,1,-1, 1,0原创 2017-10-24 22:40:28 · 586 阅读 · 0 评论 -
[noip2014]无线网络发射器选址 题解
模拟题不要太简单,枚举每一个2d*2d的正方形,看有几个点在里面就好了。看一个点是否在正方形中,看一看坐标关系就好了。#include<bits/stdc++.h>using namespace std;int d,n,x[25],y[25],k[25],mx,sum,tot;int main(){ freopen("in.txt","r",stdin); scanf("%d原创 2017-10-24 22:49:50 · 633 阅读 · 0 评论 -
[noip2012]Vigenère 密码 题解
哇,好长一张表。。。。。难道要手打这么长的表,而且还不能复制233。其实,可以不必这么麻烦,我们观察一下,我们另A:=0,B:=1….Z:=25,那么加密就是把两个数加起来再模26,转换回去就好了。注意记录大小写。#include<bits/stdc++.h>using namespace std;char s[2000];int key[2000],tmp,x,L;int main(){原创 2017-10-29 21:04:36 · 431 阅读 · 0 评论 -
bzoj4917 [Lydsy六月月赛]Hash Killer IV
啊哈,Hash Killer 4,不过,一开始我还以为又是什么字符串神题,没想到啊233。其实可以打表(逃好吧,说正解,我们可以手推几个式子,发现有些位子是固定了的,然后就可以全部确定了,多好,模拟题呀。#include<iostream>#include<cstdio>#include<cstring>#include<bits/stdc++.h>using namespace std;原创 2017-11-02 22:19:27 · 276 阅读 · 0 评论 -
bzoj3192 [JLOI2013]删除物品
题目咋眼一看,这道题就是一道模拟题,不过,应该要加高级数据结构(笑)。首先,我们可以把两堆堆顶合成一个堆顶就方便处理了,我们来感性认识一下,就把第一堆翻转一下,第二堆接在后面。我们维护一个堆顶,每次答案加上 最大的数到堆顶中数的个数 。而且如果这样的话,移动物品也就不用处理了,一举两得,多好。#include<bits/stdc++.h>#define N 100005using namespa原创 2017-08-30 07:42:11 · 267 阅读 · 0 评论