上一页 1 ··· 37 38 39 40 41 42 43 44 45 ··· 182 下一页
摘要: 题意:给出一个矩阵(100×100)求一个子矩阵,使得子矩阵中各个元素的和最大。分析:类似最大子段和,我们可以将这个矩阵一些列的集合,如果最优解(最大子矩阵)左起第i列,右止于第j列,上下边界先不管。那么我们相当于把这些列的对应位加和,成为一列。并对改列求最大子段和即可。这样我们只需要枚举所有的i和j,然后合并列,然后求最大子段和,取最大即可。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace 阅读全文
posted @ 2013-01-10 17:10 undefined2024 阅读(988) 评论(0) 推荐(1)
摘要: 高精度,java做View Code import java.io.*;import java.util.*;import java.math.*;public class Main { public static boolean equal(String a, String b, int x) { int len = a.length(); for (int i = 0; i < len; i++) if (a.charAt(i) != b.charAt((i + x) % len)) ret... 阅读全文
posted @ 2013-01-09 18:53 undefined2024 阅读(252) 评论(0) 推荐(0)
摘要: 题意:给出公式V2=iR,V2=Vr * cos(wt + q), V1=Vs * cos(wt), i = C * d(v1 - v2)/dt; d是求导数的意思。已知Vs,R,C,w,求Vr。分析:利用V2分别等于两个式子,将i,V2和V1带入,可得方程:R*C*d(Vs * cos(wt) - Vr * cos(wt + q))/dt = Vr * cos(wt + q)根据求导公式:d(cos(x))/dx = -sinx可将原方程化为:R*C*w*(Vr*sin(wt + q) - Vs*sin(wt)) = Vr * cos(wt + q)在这里三角函数的参数有两个:wt+q和wt 阅读全文
posted @ 2013-01-08 20:02 undefined2024 阅读(1259) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 20struct Point{ int x, y, z;} point[maxn], s;int dist(Point a, Point b){ Point v; v.x = a.x - b.x; v.y = a.y - b.y; v.z = a.z - b.z; return v.x * v.x + v.y * 阅读全文
posted @ 2013-01-08 19:06 undefined2024 阅读(448) 评论(0) 推荐(0)
摘要: 题意:有一些未知数各不相等,给出一些两两比较的大小关系,问到第几个关系开始可以确定整体排序或出现矛盾,再或者所有关系都用过了也无法确定整体排序。分析:闭包传递,我们每获得一个比较关系就更新我们已知的关系库,关系库中要记录所有我们现在已知的能比较大小的关系对。一条大小关系a<b的信息可以给我们提供如下信息:1.a<b2.所有小于a的未知数都小于b3.所有大于b的未知数都大于a4.所有大于b的未知数都大于所有小于a的未知数利用以上四条信息我们可以获得更多的两两大小关系。判断是否已确定整体排序的方法是,判断我们当前的关系库中是否所有对的大小都已知(因为我们能推断出的关系都在关系库中,如果 阅读全文
posted @ 2013-01-08 15:50 undefined2024 阅读(1162) 评论(0) 推荐(0)
上一页 1 ··· 37 38 39 40 41 42 43 44 45 ··· 182 下一页