上一页 1 ··· 149 150 151 152 153 154 155 156 157 ··· 182 下一页
摘要: 简单题,类似高精度View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>using namespace std;#define maxn 12char num1[maxn], num2[maxn];int main(){ //freopen("t.txt", "r", stdin); while (1) { scanf("%s%s&quo 阅读全文
posted @ 2011-05-20 13:38 undefined2024 阅读(210) 评论(0) 推荐(0)
摘要: 最小生成树View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>using namespace std;#define maxn 105struct Point{ double x, y;} point[maxn];double cost[maxn][maxn];int n;double dis(int a, int b){ return sqrt((point[a].x - point[b]. 阅读全文
posted @ 2011-05-20 13:11 undefined2024 阅读(192) 评论(0) 推荐(0)
摘要: 题意:给出一个柱状图,各柱之间没有空隙。要求在这些柱覆盖的面积中画出一个最大的矩形(可跨越多个柱),求该矩形面积。分析:用栈来维护一个严格升序序列,出栈时对元素的扩展面积进行计算,栈顶元素左右的扩展范围是,栈中的前一个元素的位置+1到当前读入元素的位置-1。long long = int * int的时候第一个int要强制转换为long long。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>usingnamespace std; 阅读全文
posted @ 2011-05-18 21:16 undefined2024 阅读(694) 评论(0) 推荐(0)
摘要: 题意:给出三个质数,求这素因子只有这三个质数的数中第k大的。分析:用一个数列,第一位是1。用三个指针指向三个prime要乘的被乘数,最开始都指向1。每次取乘积最小的加入数组,并把指针后移。加入时要判断是否重复,若重复则不加入。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>usingnamespace std;#define maxn 10000longlong p[3], n, pos[3], a[maxn];int main() 阅读全文
posted @ 2011-05-18 20:00 undefined2024 阅读(185) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;char key[4][20];int main(){ //freopen("t.txt", "r", stdin); strcpy(key[0], "1234567890-="); strcpy(key[1], "QWERTYUIOP[]\\"); strcp 阅读全文
posted @ 2011-05-18 19:29 undefined2024 阅读(209) 评论(0) 推荐(0)
上一页 1 ··· 149 150 151 152 153 154 155 156 157 ··· 182 下一页