
模拟
文章平均质量分 74
vvv_557
这个作者很懒,什么都没留下…
展开
-
zoj 3327 Friend Number 枚举 分类讨论 模拟
题意: 一个数的友好特征是它数位上的每一位数相乘后的积,如果两个数的友好特征相同那它们是friend number. 现在让我们求比输入数据大,最接近输入数据的数字。 分析: 1.如果数位上有0,友好特征是0; 如果0不在最后位,答案在原有基础上加一。如果0在最后位,在零前面的数字加一。模拟。 if(zero) { int z,o=len-原创 2017-02-15 10:42:28 · 585 阅读 · 2 评论 -
FZU 2108 Mod problem 数学与模拟
把括号与它后面的第一个数看成一个单元,相邻单元之间的结果可以叠加上去,单元的结果由子单元的叠加值在求幂得出.。 (a*b)%c=(a%c)*(b%c)%c ll Pow(ll n) { ll x=10,ans=1; ll len,mod,nl,mm; while(n) { if(n&1) { ans = (ll)ans*x; ans %= b; } x =(ll)x*x;原创 2017-03-21 14:22:34 · 483 阅读 · 0 评论 -
hdu 5929 Basic Data Structure 找规律 模拟
Mr. Frog learned a basic data structure recently, which is called stack.There are some basic operations of stack: ∙ PUSH x: put x on the top of the stack, x must be 0 or 1. ∙ POP: throw the原创 2017-03-04 16:17:55 · 455 阅读 · 0 评论 -
Hdu 5821 Ball 贪心+模拟
/* n个数的序列,给你m次操作, 每次操作 [l,r]中的数随意调换位置, 问能否变成目标序列。 题解在最后 */ // anthor WWQ #include #include #include #include #include using namespace std; int n1[1005]; int n2[1005]; struct node原创 2017-07-19 09:32:03 · 256 阅读 · 0 评论 -
fzu 2283 模拟
/* 给定目标棋盘,目标棋子。 判断两步内能否必胜。 3重for 枚举第一步,敌手第一步,第二步。 */ #include #include #include #include #include using namespace std; typedef long long ll; char g[6][6],ox[2],s; int check(char ss) { for(int i=原创 2017-07-23 16:30:07 · 363 阅读 · 0 评论 -
LA 2995 模拟+松弛排除矛盾
/* 给出正方体的6个面的观察图, 其中组成大正方形的小正方形单色。 模拟 松弛排除矛盾 */ #include #include #include #include using namespace std; #define REP(i,n) for(int i=0;i<n;i++) const int maxn = 10; int n; char pos[maxn][maxn][max原创 2017-07-24 16:27:47 · 269 阅读 · 0 评论 -
Hdu 6034 细心 数组少开
/* 细心:马虎,数据少开了10倍,T了4小时- - 题意;给你一堆a-z的字符串,a-z的权值自己定,要求最后所有字符串的总和最大,按26进制展开。 很显然要统计每个字母的出现次数 —>与位置有关, 那利用数组储存次数,根据关系,表现成26进制。 再利用队列优化储存数组,提升速度 249ms. */ #include #include #include原创 2017-07-26 21:48:56 · 413 阅读 · 0 评论 -
hdu 6161 Big binary tree
/* 最长距离 1 .当前x 为根节点的最长直径 ,或 一层一层往上走 包含x的一边 ,加另一部分最长半径。 设 ans[x] 为 以x 为根节点的 最长半径, chance x, 只影响 x 和x 的祖先。 未影响的 ans 选择 最右的路径 或 从 n 往上爬 看是否爬到 x */ #include #include #include #include #原创 2017-10-13 22:20:47 · 296 阅读 · 0 评论 -
Gym - 101243E Cupcakes
/* p 为贪婪的人位置 ,每个人 必须吃一个, p尽量吃。 当k <p-1 时 ,在p-1之前 结束, [p-1,sum[p-1]] 可以在p-1结束: p-1+c[p] >sum[p-1] 时,p结束, 第2轮,n轮,同理。 每轮至少吃了 n-1 +c[p] ,至多吃了sum[n] */ #include #include #include using原创 2017-10-16 15:38:39 · 307 阅读 · 0 评论