06 2013 档案
摘要:链接 :http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2109 1 #include 2 int a[100000],temp; 3 int main() 4 { 5 int sort(int i,int j,int *a); 6 int i,j,n; 7 scanf("%d",&n); 8 for(i = 0;i a[i]) {mark = 0;temp = a[i];a[i] = a[j];a[j] = temp;} 31 ...
阅读全文
摘要:链接 :http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=2127&cid=1184AC code 130ms 和优先队列还是有一定差距的 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 struct N 9 {10 int data;11 N *l,*r;12 };13 14 struct N *creat()15 {16 N *p = (N *)malloc(sizeof(N));17 p->l =...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 struct N 10 { 11 char data; 12 N *l,*r; 13 }; 14 15 N *creat() 16 { 17 N *p = (N *)malloc(sizeof(N)); 18 p->l = p->r = NULL; 19 return p; 20 } 21 22 void insert(N *root,char s) ...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 struct N 10 { 11 char data; 12 N *l,*r; 13 }; 14 15 N *creat() 16 { 17 N *p = (N *)malloc(sizeof(N)); 18 p->l = p->r = NULL; 19 return p; 20 } 21 22 int site = 0; 23 24 bool in...
阅读全文
摘要:链接 :http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1500题目大意 : 先输入N个字符串,再输入M个字符串,统计一下N个中有多少个为在M个出现。注意转换大小写。时间 110MS 内存 1474KB#include #include #include #include #include #include using namespace std;struct N{ char b[11]; bool m; struct N *l,*r;};N *creat(){ N *p = ...
阅读全文
摘要:题目链接: http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=1482&cid=1180 关键在于对字符串的操作。 两种情况: ‘+’ 此时要把x和y指数均相同的项的系数相加。若链表中不存在系数相同的,则按优先级顺序插入当前项。 ‘*’ 把任意两项(不属于同一式子的两项)都要相乘。系数相乘,指数相加。 最后要考虑一下存在 0 的情况。 优先级关系。 x的指数越大优先级越高。 x的指数相同时,比较y。 常数优先级最低。 特例:x > x^ny^m AC_code 1 #include <cstdio>...
阅读全文
摘要:#include <cstdio>#include <cstring>#include <cstdlib>#include <iostream>#include <algorithm>using namespace std;struct N{ int data; char name[21]; N *next;};N *creat(){ N *p = (struct N *)malloc(sizeof(struct N)); p->next = NULL; return p;}void link(N *head,N *p){ N
阅读全文
摘要:HDU 1542 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1542题目大意就是几个矩形相交,然后求出总的覆盖面积,覆盖多次的按一次算。典型的面积并问题。大体思路: 记录所给的点,排序,去掉重复的点,对点编号,可以理解成存放点的数组的下表即为编号。 对Y轴建立线段树,利用线段树计算面积。 AC_code: 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #include <iostream> 5 #include
阅读全文
浙公网安备 33010602011771号