ACM
文章平均质量分 61
井枯旋
坚持
展开
-
【去哪儿】笔试
去哪儿笔试原创 2015-09-21 13:23:21 · 492 阅读 · 0 评论 -
【数学】HDU 1222 Wolf and Rabbit
链接:现在是晚上原创 2014-04-28 18:54:41 · 522 阅读 · 0 评论 -
HDU 1215 七夕节
一:直接暴力(注意范围)#include #include #include #include #include #include using namespace std;int main(){ int n; while(scanf("%d", &n) != EOF) { while(n--) {原创 2014-04-27 16:34:20 · 492 阅读 · 0 评论 -
【数学】HDU 1214 圆桌会议
一条线上的n个人,123..n变为n..321,需要1+2+...+(n-1)=n*(n-1)/2次,即1右移n-1步,2右移n-2步..。而该题是围成一圈,所以可以双向移动, 因而将n分成两部分,n原创 2014-04-27 15:49:55 · 480 阅读 · 0 评论 -
【数学 逆元】HDU 1211 RSA
链接:天气不好模拟了一下RSA原创 2014-04-27 14:43:06 · 445 阅读 · 0 评论 -
HDU 1178 Heritage from father
数学题,数列#include #include #include using namespace std;int main(){ double n; while(scanf("%lf", &n) != EOF && n) { double x = log10(n/6.0) + log10(1.0* (n+1)) + log10(1.0原创 2014-04-27 14:19:36 · 606 阅读 · 0 评论 -
【数学 分解质因素】HDU 1164 Eddy's research I
链接:呵呵原创 2014-04-26 13:32:31 · 445 阅读 · 0 评论 -
【数学 合九法】HDU 1163 Eddy's digital Roots
一:#include #include #include #include #include using namespace std;int main(){ int n; int s[] = {9,1,4,9,4,2,9,7,1,9,1,5,9,4,7,9,7,8,9}; //暴力找规律 while(scanf("%d", &n) != EOF &&原创 2014-04-25 18:37:36 · 760 阅读 · 0 评论 -
【数学 象限】HDU 1152 Brownie Points I
链接:井枯旋原创 2014-04-24 15:03:14 · 531 阅读 · 0 评论 -
【数学 物理】HDU 1155 Bungee Jumping
链接:Lux这题的意思是给你一根绳子,kesh原创 2014-04-24 20:22:01 · 457 阅读 · 0 评论 -
【数学 递推】 HDU 1143 Tri Tiling
链接:Luxcankaon为奇数肯定为0,n为偶数,每次都是加两列,我们把两列看为一列,如果这一列与前面分开就只有三种方法即3*a[n-2],如果这一列不与前面的分开,那么不可分解矩形都只有两种情况所以为2*(a[n-4]+a[n-6]+……a[0])化简即为a[n]=4*a[n-2]-a[n-4]原创 2014-04-24 12:35:32 · 403 阅读 · 0 评论 -
【数学 对数】HDU 1141 Factstone Benchmark
/*题意:求cnt! < 2^m 的最大的cnt,其中2^m为计算机的位数;取对数:log(1) + log(2) +...+ log(cnt) < m* log(2)然后,就没有然后了。。。*/#include #include #include #include #include using namespace std;int main(){ int m;原创 2014-04-24 10:09:28 · 418 阅读 · 0 评论 -
【数学】 HDU 1124 Factorial
链接:XXXXX题目看起来原创 2014-04-23 17:37:11 · 445 阅读 · 0 评论 -
【数学】 HDU 1110 Equipment Box
HDU 1110 Equipment Box原创 2014-04-22 17:40:43 · 577 阅读 · 0 评论 -
【数学】 HDU 1099 Lottery
HDU #include #include #include #include using namespace std;__int64 gcd(__int64 a, __int64 b){ if(b == 0) return a; return gcd(b, a % b);}__int64 getlen(__int64 x){ __int64 cn原创 2014-04-22 15:18:56 · 450 阅读 · 0 评论 -
【多边形重心】hdu 1115 Lifting the Stone
转自:http://hi.去掉baidu.com/tianzhang去掉0000/item/1f7617ba去掉567c1f5dba0e12ad(去掉 “去掉”)#include#include#include#include#includeusing namespace std;struct point//点{ double x; double y;};转载 2014-04-22 20:56:06 · 475 阅读 · 0 评论 -
【最小生成树】ZOJ 2966 Build The Electric System
题意大致就是连通所有点的需要的最小代价,典型的最小生成树。本人用了Prim来算。#include #include #include #include #include #define MAXN 1000#define INF 1<<30using namespace std;int closest[MAXN],lowcost[MAXN],m;// m为节点的个数int G原创 2014-02-24 19:30:52 · 619 阅读 · 0 评论 -
【zoj】 3778 Talented Chef
比赛的时候,用了sort排序,模拟,感觉应该不会超市原创 2014-04-14 10:21:18 · 828 阅读 · 0 评论 -
【欧拉函数】hdu 1286 找新朋友
链接:今天天气不好就是一个欧拉函数的模板tim原创 2014-05-14 15:59:09 · 534 阅读 · 0 评论 -
【蘑菇街笔试】
蘑菇街笔试原创 2015-09-19 21:23:11 · 2108 阅读 · 0 评论 -
hdu 5423 Rikka with Tree
参考:http://blog.csdn.net/aaaaacmer/article/details/48093767转载 2015-09-02 15:11:29 · 396 阅读 · 0 评论 -
hdu-5422 Rikka with Graph
题意: n个点构成的图,连接一条边,使点1和n之间的距离最短。 题解: 点1和n的距离最短肯定是1啊,直接连接1和n就好了。如果之前1和n已经有边连接了,那就随便连接一条边好了,就是(n*(n-1))>>1啊。原创 2015-08-31 09:05:11 · 447 阅读 · 0 评论 -
【百度之星】1003 IP聚合
百度之星资格赛 1003原创 2015-05-24 14:53:20 · 843 阅读 · 0 评论 -
【百度之星资格赛】 1002 列变位法解密
Problem Description列变位法是古典密码算法中变位加密的一种方法,具体过程如下 将明文字符分割成个数固定的分组(如5个一组,5即为密钥),按一组一行的次序整齐排列,最后不足一组不放置任何字符,完成后按列读取即成密文。比如:原文:123456789密钥:4变换后的矩阵:123456789xxx(最后的几个x表示无任何字符,不是空格,不是制表原创 2015-05-24 14:46:58 · 662 阅读 · 0 评论 -
【数学 逆元】zoj 3609 Modular Inverse
#include <iostream>#include <cmath>#include <algorithm>#include <cstdio>using namespace std;int x,y,q;void extend_Eulid(int a,int b){ if(b == 0) { x = 1; y = 0; q =原创 2015-04-14 15:31:49 · 464 阅读 · 0 评论 -
【计算几何】ZOJ 2967 Colorful Rainbows
以下为摘抄的讲解: 给定直线,对每条直线,传说解不等式组可以过,直接看是否存在一个点在直线之上。(左端点取max,右端点取min,如果左>=右,直接break掉)。有点ft...O(n^2) n=5000 rp好的可以过.... 我用的方法类似于凸包,先把所有直线按照斜率a由小到大排序,斜率相同取b较大的,扔掉b小的。于是所有直线斜率不同。准备一个栈,栈里面存放上一次能看到的原创 2014-02-24 19:41:15 · 1079 阅读 · 0 评论 -
【打表 or 规律】ZOJ 2965 Accurately Say "CocaCola"!
题目链接:ZOJ 2965 Accurately Say “CocaCola”!我先用打表做了下,也是能A的#include <iostream>#include <algorithm>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <cmath>using namespace std;int st[111原创 2015-03-30 10:57:02 · 404 阅读 · 0 评论 -
【DP】ZOJ 2852 Deck of Cards
ZOJ 2852 Deck of Cards参考自:AC_Vonf[j][k][l]表示slot x1, x2, x3的值为j,k,l时的最优值。pre[j][k][l]表示他的前一个状态。#include <iostream>#include <algorithm>#include <stdio.h>#include <stdlib.h>#include <string.h>#inclu转载 2015-03-29 19:51:05 · 368 阅读 · 0 评论 -
【暴力】ZOJ 1856 Happy Life
【ZOJ】1856 Happy Life暴力求解,只要每次改变happiness值为负的人的符号即可。 这题是保证有解的,至于为何难以证明。#include <iostream>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <algorithm>#include <queue>using namesp原创 2015-03-29 18:07:26 · 493 阅读 · 0 评论 -
【二分图】专题
refer:http://blog.csdn.net/hackbuteer1/article/details/7398008http://poj.org/problem?id=1469转载 2014-10-28 19:31:10 · 378 阅读 · 0 评论 -
【模拟 数学】二进制串的运算
暑假有点热。。。原创 2014-07-30 19:22:56 · 620 阅读 · 0 评论 -
【素数算法】Rabin-Miller算法
#include #include #include #define ll long longll pow(ll b,ll m,ll n){ ll sum=b,ans=1; while (m) { if (m%2) ans=(ans*sum)%n; sum=(sum*sum)%n; m/=2转载 2014-07-30 14:57:34 · 552 阅读 · 0 评论 -
【线段树】总集(二)
成段更新。需要用到延迟标记(或者说懒惰标记),简单来说就是每次更新的时候不要更新到底,用延迟标记使得更新延迟到下次需要更新or询问到的时候原创 2014-04-20 21:46:46 · 448 阅读 · 0 评论 -
【线段树】总集(一)
#include #include #include #include #include #define Maxn 10000using namespace std;int tttt,maxx;struct node{ int l, r, cnt;} xx[2500000];void build(int a, int b, int n){ if(n >原创 2014-04-07 16:39:19 · 518 阅读 · 0 评论 -
【并查集】 HDU 1213 How Many Tables
HDU 1213 How Many Tables纯粹的并查集原创 2014-04-20 21:56:36 · 458 阅读 · 0 评论 -
并查集
#include#include#include#includeusing namespace std;int father[50002],a,b,m,n,p;int find(int x){ if (father[x]!=x) father[x]=find(father[x]); return father[x];}int main(){ scanf("%原创 2014-03-10 11:31:33 · 454 阅读 · 0 评论 -
【数学题】ZOJ 3205 Derivative
写程序过程中,各种小问题,真是令人揪心。。。#include #include #include #include #include #include #include #define MAXN 110#define mm(a) memset(a, 0, sizeof(a))using namespace std;int pw[MAXN][MAXN];void crea原创 2014-03-27 21:43:53 · 837 阅读 · 0 评论 -
【DFS】hdu 1175 连连看
#include #include #include #include using namespace std;int g[1010][1010];int vis[1010][1010];int flag, n, m, sx, sy, ex, ey;void dfs(int x, int y, int cnt, int dire){ if(x = n || y >= m)原创 2014-03-16 20:52:50 · 391 阅读 · 0 评论 -
C++ STL map
常用的map一些操作在下面的程序中都可以找到,相信你一定会看懂的。#include #include #include #include #include using namespace std;map mp;map ::iterator it;/* map::iterator it; * 定义一个迭代指针it. * it->first 为索引键值原创 2014-03-09 22:20:56 · 503 阅读 · 0 评论 -
ZOJ 3603 Draw Something Cheat
题意是给你几组字符串,从中找出在每个字符串中都出现的字母,可以重复。比如说,AAA,和AA,那么结果就是AA。#include #include #include #include #include #define mm(a) memset(a, 0, sizeof(a))using namespace std;int main(){ char s[20];原创 2014-03-09 15:14:29 · 752 阅读 · 1 评论