码迷,mamicode.com
首页 >  
搜索关键字:ans    ( 3741个结果
SGU 181.X-Sequence
时间限制:0.5s空间限制:4M题意: 令X0=A, Xi=(a*Xi-1^2,b*Xi-1+c)%m; 求Xk,(0#include #include #include using namespace std;const int INF = 111111;vector ans;...
分类:其他好文   时间:2014-07-19 21:11:36    阅读次数:259
uva 1586 - Molar mass
在想更好的处理方法,现在却只能有这个糟烂的代码了……不好意思#include #include #include using namespace std; const int maxn=200; char s[maxn]; double ans[maxn]; int get_num(int pos,int len) { int temp; for(int i=pos;i<len...
分类:其他好文   时间:2014-07-18 18:07:51    阅读次数:220
hdu 4308 Saving Princess claire_ BFS
为了准备算法考试刷的,想明白一点就行,所有的传送门相当于一个点,当遇到一个传送门的时候,把所有的传送门都压入队列进行搜索 贴代码: #include #include #include #include #include using namespace std; const int MAXN = 5000+50; int r,c,f,si,sj,ei,ej,ans;...
分类:其他好文   时间:2014-07-18 14:08:32    阅读次数:245
BZOJ 2761 不重复数字 (Hash)
题解:直接使用STL中的hash去重即可#include #include using namespace std;int ans[50010];int main(){ int T,n,tmp; scanf("%d",&T); while(T--){ int cnt=...
分类:其他好文   时间:2014-07-17 10:02:58    阅读次数:231
HDU 2492 Ping pong
题意: 一串数字  问  有几种这样的组合(x,y,z)使得x>y>z或x 思路: 对于一个数字  比如 f  它计算出的ans值为  ( beforef.lessthanf * afterf.biggerthanf )+( beforef.biggerthanf * afterf.lessthanf ) 易知 beforef.biggerthanf = locationf - ...
分类:其他好文   时间:2014-07-16 17:25:35    阅读次数:173
uva 1377
比较不错的一个题,关键是理解状态转移#include#include#include#include#define maxn 55using namespace std;int m,ans;int num[maxn],vis[maxn];bool cnt[1000009];int scale[10]...
分类:其他好文   时间:2014-07-16 15:06:35    阅读次数:216
UVa10608
FRIENDS题意:找出最大的朋友圈#include #define N 30005int fa[N], ans[N];int find(int x){ return fa[x] == x ? x : fa[x] = find(fa[x]);}int main(int argc, char *...
分类:其他好文   时间:2014-07-15 08:48:35    阅读次数:214
Codeforces 446B DZY Loves Modification 矩阵行列分开考虑 优先队列+构造
题目链接:点击打开链接 题意: 给定n行m列的矩阵 k次操作,一个常数p ans = 0; 对于每次操作 可以任选一行或一列, 则ans += 这行(列)的数字和 然后这行(列)上的每个数字都-=p 问最大的ans 思路: 首先我们设最终选了 行 i 次,则列选了 k-i 次 那么假设我们先全部选行,然后选列,则每次选列时,要-= i*p 这样最后是 -= i...
分类:其他好文   时间:2014-07-14 17:38:20    阅读次数:203
codeforces#FF(div2) D DZY Loves Modification
首先要知道选择行列操作时顺序是无关的 用两个数组row[i],col[j]分别表示仅选择i行能得到的最大值和仅选择j列能得到的最大值 这个用优先队列维护,没选择一行(列)后将这行(列)的和减去相应的np (mp)重新加入队列 枚举选择行的次数为i,那么选择列的次数为k - i次,ans = row[i] + col[k - i] - (k - i) * i * p; 既然顺序无关,...
分类:其他好文   时间:2014-07-14 16:44:35    阅读次数:205
ZOJ2165 简单DFS搜索
1 #include 2 #include 3 #include 4 #include 5 #define MAXN 25 6 using namespace std; 7 int h,w; 8 int ans; 9 int dir[4][2]={-1,0,1,0,0,-1,0,1};10 cha....
分类:其他好文   时间:2014-07-13 20:30:45    阅读次数:215
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!