模拟算法
文章平均质量分 55
muczzcy
这个作者很懒,什么都没留下…
展开
-
POJ 2339 Rock, Scissors, Paper
/* 题意:在一张row*col的图中,每个格由R,S,P中的一个组成,在一个单位时间里,R能取代掉它旁边(上下左右)的S,S能取代掉P,P能取代掉R,取代不当时生效,过一天后统一生效。问在n个单位时间后,图上R,S,P的分布是怎么样的。r,c,n*/ #include#include#include#include#includeusing namespace s原创 2013-02-12 17:20:50 · 434 阅读 · 0 评论 -
hdu 2212 DFS ---- 算法思考题(模拟)
Sol:题目就是145!=1!+4!+5!这样的数有几个。。。范围【1,2147483647】如果十位数都是9的话这个和也只有3628800.或者直接打表。。。。#include #include #include using namespace std;const int maxn = 11;int a[maxn];int solve(int n) /原创 2014-01-18 18:32:21 · 706 阅读 · 0 评论 -
hrbust 1997 又是一个神奇的布尔矩阵
SoL:模拟就可以了。#include #include #include using namespace std;const int maxn = 100 + 10;int n,m;int a[maxn][maxn];int main(){ while(~scanf("%d%d",&n,&m)) { for(int i=0;i<=n;i++) a[i][原创 2014-01-15 22:11:04 · 598 阅读 · 0 评论 -
hrbust 1995 伟大的一食堂
SoL:根据题意,即可知道是对3取余和整除的运算找规律的题。稍微推下就好。#include #include #include #include using namespace std;int N;int main(){ while(~scanf("%d",&N)) { int a,b,s; int cnt=0; while(1) { a=N%原创 2014-01-15 22:07:46 · 527 阅读 · 0 评论 -
hrbust 1994 神奇的布尔矩阵
SoL:模拟即可。。。#include #include #include #include using namespace std;const int maxn = 200 + 10;int map[maxn][maxn];int sumcol[maxn],sumrow[maxn];int n;int main(){ while(~scanf("%d",&n))原创 2014-01-15 22:05:51 · 662 阅读 · 0 评论 -
hrbust 1992 比赛积分
SoL:01背包。。。#include #include #include #include using namespace std;const int maxm = 1000 + 10;const int maxn = 100 + 10;int dp[maxm];int value[maxn];//每袋的价格int weight[maxn];//每袋的重量int原创 2014-01-15 22:02:39 · 695 阅读 · 0 评论 -
hrbust 1991 计算器显示
SoL:模拟即可。。。- -||# include# includeint main(void){ int n; char s[11]; int i,j,k; while(~scanf("%d %s",&n,s)) { int len = strlen(s); for(i = 0;i < len;++i)原创 2014-01-15 22:00:40 · 644 阅读 · 0 评论 -
hrbust 1990 函数F(x)
SoL:模拟即可~~#include #include #include using namespace std;const int maxn = 1000;int solve(int n){ int cnt=0; if(n==1) return 1; for(int i=1;i<=n;i++) { if(n%i==0) cnt++; } return原创 2014-01-15 21:59:29 · 691 阅读 · 0 评论 -
HDU 4018 Parsing URL
/*水题模拟*/Problem : 4018 ( Parsing URL ) Judge Status : AcceptedRunId : 7622177 Language : C++ Author : CherryChouCode Render Status : Rendered By HDOJ C++ Code Render Version 0.01 Bet原创 2013-02-17 12:52:10 · 476 阅读 · 0 评论 -
hdu 1013 Digital Roots
水题。不解释。#include#include#includeusing namespace std;int main(){ int n; string s; while(cin>>s&&s[0]!='0'){ n=0; for(int i=0;i n+=s[i]-'0'; while(n>9) n原创 2013-01-21 09:20:54 · 246 阅读 · 0 评论 -
HDU 4006 The kth great number(STL)
/*用STL set 去维护集合的大小为k*/Problem : 4006 ( The kth great number ) Judge Status : AcceptedRunId : 6313274 Language : C++ Author : CherryChouCode Render Status : Rendered By HDOJ C++ Cod原创 2013-02-13 22:27:49 · 378 阅读 · 0 评论 -
HRBEU 石头剪刀布1
石头剪刀布1TimeLimit: 1 Second MemoryLimit: 32 MegabyteTotalsubmit: 73 Accepted: 30 Description放寒假了,x一个人在家很无聊。于是他就想出了一种新的石头剪刀布玩法(单机版的哦)。玩法如下:S代表石头,J代表剪刀,B代表布。赢得一分,平不得分,输扣一分原创 2013-02-12 21:46:06 · 441 阅读 · 0 评论 -
ZOJ 1201 Inversion
/*两个子函数,当输入序列时,从序列后面往前遍历,找他后面比他大的数的个数,然后用总数减掉这个数,和比他大的个数,放入对应的数组中,另一个子函数从前面遍历*/#include#include#include#includeusing namespace std;int a[55],b[55];void workp(int n){ int cnt;原创 2013-02-12 17:34:49 · 304 阅读 · 0 评论 -
HRBEU 占武卖花
占武卖花TimeLimit: 1 Second MemoryLimit: 64 MegabyteTotalsubmit: 8 Accepted: 2 Description占武是经济学班的学生,不过和那些理论家不同,占武是个务实型。他始终认为任何经济活动脱离了实际操作都是不可靠的。最近他在学习心理经济学,为了检测商品配置对购物者心理的影响,他决原创 2013-02-12 22:09:34 · 852 阅读 · 0 评论 -
ZOJ 1243 URLs
/*字符串模拟题*/#include#include#include#include#include#define rep(i,n) for(i=1;iusing namespace std;char s[100];int T,i,j,k,n,len;int main(){ scanf("%d",&T); rep(k,T){ s原创 2013-02-12 17:28:36 · 258 阅读 · 0 评论 -
HDU 2029 Palindromes _easy version
Sol:一个数异或两次等于没操作。这题跟12年东北赛一题很像。。。#include using namespace std;inline void scan(int &x){ char c; while(c=getchar(),c'9'); x=c-'0'; while(c=getchar(),c>='0'&&c<='9') x原创 2014-02-05 17:00:36 · 658 阅读 · 0 评论