随笔分类 -  HDU

上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 19 下一页

 
HDU 1286 找新朋友
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1286裸欧拉函数,欧拉函数是求比n小的数中有多少个与n互质View Code #include <iostream>#include <cstdlib>#include <cstring>#include <string>#include <stack>#include <queue>#include <map>#include <algorithm>using namespace std;const int MA 阅读全文
posted @ 2012-05-25 00:04 LegendaryAC 阅读(295) 评论(0) 推荐(0)
HDU 4163 Stock Prices
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4163稳定排序View Code #include <iostream>#include <cstdlib>#include <cstring>#include <string>#include <stack>#include <queue>#include <map>using namespace std;typedef struct L{ int price; int idx;}L;L kk[1000001];int cm 阅读全文
posted @ 2012-05-24 23:19 LegendaryAC 阅读(210) 评论(0) 推荐(0)
HDU 1872 稳定排序
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1872稳定排序,用一个变量idx记录位置保持稳定View Code #include <iostream>#include <cstdlib>#include <cstring>#include <string>#include <stack>#include <queue>#include <map>using namespace std;typedef struct L{ char name[51]; int score; 阅读全文
posted @ 2012-05-24 22:04 LegendaryAC 阅读(253) 评论(0) 推荐(0)
HDU 1022 Train Problem I
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1022STL中栈的应用练习,数组要开够啊。。。无语View Code #include <iostream>#include <stack>using namespace std;int main(){ stack <char> s; char in[11],out[11]; int n; bool flag[30]; while(~scanf("%d%s%s",&n,in,out)) { int i,j,cnt; i=j=cnt=0; ... 阅读全文
posted @ 2012-05-24 16:30 LegendaryAC 阅读(148) 评论(0) 推荐(0)
HDU 1273 漫步森林
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1273乱搞题,n-1减去起点,把剩下的点分成尽可能相等的两部分1、2(为了得到尽可能大的答案),对于1内部来讲,显然总能保证“新鲜”,在新鲜1后,不难看出2的每个点都对应着一个“新鲜”说的乱七八糟,大概就这样吧。。。View Code #include <iostream>#include <queue>#include <stack>#include <vector>using namespace std;int main(){ int n; while(sc 阅读全文
posted @ 2012-05-24 13:46 LegendaryAC 阅读(249) 评论(0) 推荐(0)
HDU 3584 Cube
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3584裸三维树状数组。。。除了三维的容斥要稍微想一下别的都和一维、二维的一样了View Code #include <iostream>using namespace std;const int MAX=101;int n;int tree[MAX][MAX][MAX];int lowbit(int i){ return i&(-i);}void update(int x,int y,int z){ for(int i=x;i<=n;i+=lowbit(i)) for(int j=y 阅读全文
posted @ 2012-05-23 19:11 LegendaryAC 阅读(141) 评论(0) 推荐(0)
HDU 2642 Stars
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2642裸二维树状数组,没有秒杀,坑点是这题的询问是x1,x2,y1,y2(其实题目说得清清楚楚,惯性思维害死人?写完不过sample无力吐槽)。然后犯了一个巨2的笔误,死活没查出来,还是让路人王同学看出来的、、、、跪了View Code #include <iostream>using namespace std;const int MAX=1010;int vis[MAX][MAX],tree[MAX][MAX];int lowbit(int i){ return i&(-i);}voi 阅读全文
posted @ 2012-05-23 13:12 LegendaryAC 阅读(262) 评论(0) 推荐(0)
HDU 1892 See you~
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1892二维树状数组,很裸。。。View Code #include <iostream>#include <algorithm> #include <cstring>using namespace std;const int MAX=1010;int weight[MAX][MAX],tree[MAX][MAX];int lowbit(int i){ return i&(-i);}void update(int x,int y,int val){ for(int i 阅读全文
posted @ 2012-05-22 21:40 LegendaryAC 阅读(137) 评论(0) 推荐(0)
HDU 1150 Machine Schedule
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1150二分图最大匹配,匈牙利算法View Code #include #include const int MAX1=101;const int MAX2=1001;int k,m,n;int match[MAX1... 阅读全文
posted @ 2012-05-21 17:55 LegendaryAC 阅读(141) 评论(0) 推荐(0)
HDU 1063 Exponentiation
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1063依然是高精度,和上一题很像,不过用上一题的方法一直超时?颇为费解。查了几个函数的用法,直接用函数操作就不超时了?这题mark一下以后还要再看,对超时表示不太理解。stripTrailingZeros()是去掉后缀0,toPlainString()是转成非指数型的字符串(上一题要知道这两个函数直接秒杀了哈。。。)。startsWith("//字符串1")判断给定字符串是否以字符串1开头(对应的还有endsWith())。substring()的用法参考百度百科,看一眼就明白了:&quo 阅读全文
posted @ 2012-05-21 11:38 LegendaryAC 阅读(144) 评论(0) 推荐(0)
HDU 1753 大明A+B
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1753在小数点存在的情况下去掉后面的0View Code import java.io.*;import java.math.*;import java.util.*;import java.text.*;public class Main{ public static void main(String[] args) { Scanner cin=new Scanner (new BufferedInputStream(System.in)); BigDecimal a... 阅读全文
posted @ 2012-05-21 10:38 LegendaryAC 阅读(154) 评论(0) 推荐(0)
HDU 1047 Integer Inquiry
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1047大数View Code import java.io.*;import java.math.*;import java.util.*;import java.text.*;public class Main{ public static void main(String[] args) { Scanner cin=new Scanner (new BufferedInputStream(System.in)); BigInteger sum,a; i... 阅读全文
posted @ 2012-05-21 10:09 LegendaryAC 阅读(114) 评论(0) 推荐(0)
HDU 1134 Game of Connections
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1134在上一题的基础上加个-1跳出的判断、、、View Code import java.io.*;import java.math.*;import java.util.*;import java.text.*;public class Main{ public static void main(String[] args) { Scanner cin=new Scanner (new BufferedInputStream(System.in)); BigInteg... 阅读全文
posted @ 2012-05-20 23:53 LegendaryAC 阅读(200) 评论(0) 推荐(0)
HDU 1130 How Many Trees?
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1130和上一题一模一样View Code import java.io.*;import java.math.*;import java.util.*;import java.text.*;public class Main{ public static void main(String[] args) { Scanner cin=new Scanner (new BufferedInputStream(System.in)); BigInteger[] f=new B... 阅读全文
posted @ 2012-05-20 23:43 LegendaryAC 阅读(332) 评论(0) 推荐(0)
HDU 1023 Train Problem II
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1023卡特兰数,要注意是大数,直接学着用java搞大数了View Code import java.io.*;import java.math.*;import java.util.*;import java.text.*;public class Main{ public static void main(String[] args) { Scanner cin=new Scanner (new BufferedInputStream(System.in)); Big... 阅读全文
posted @ 2012-05-20 23:40 LegendaryAC 阅读(161) 评论(0) 推荐(0)
HDU 2063 过山车
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2063二分图最大匹配,参照白书上邻接表建的图View Code #include #include const int MAX1=501;const int MAX2=1001;int k,m,n;int matc... 阅读全文
posted @ 2012-05-20 15:56 LegendaryAC 阅读(118) 评论(0) 推荐(0)
HDU 2164 Rock, Paper, or Scissors?
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2164剪刀石头布,无脑模拟View Code #include <stdio.h>int gao(char p1,char p2){ if(p1=='S'&&p2=='P')return 1; if(p1=='P'&&p2=='R')return 1; if(p1=='R'&&p2=='S')return 1; if(p2=='S'& 阅读全文
posted @ 2012-05-20 14:01 LegendaryAC 阅读(192) 评论(0) 推荐(0)
HDU 1280 前m大的数
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1280hash+最大堆,STL堆View Code #include <iostream>#include <map>#include <vector>#include <queue>#include <cstring>using namespace std;int hash[10001];int main(){ int n,m; priority_queue <int> q; while(~scanf("%d%d", 阅读全文
posted @ 2012-05-19 23:28 LegendaryAC 阅读(322) 评论(0) 推荐(0)
HDU 1029 Ignatius and the Princess IV
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1029看题意就是建立一个映射,用map直接过View Code #include <iostream>#include <map>using namespace std;int main(){ int n; while(~scanf("%d",&n)) { map <int ,int > M; int bz=(n+1)/2; while(n--) { int a; scanf("%d",&a)... 阅读全文
posted @ 2012-05-19 19:08 LegendaryAC 阅读(244) 评论(0) 推荐(0)
HDU 1259 ZJUTACM
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1259水题View Code #include <stdio.h>#include <string.h>int main(){ int n,m,x,y,i,a[10]; scanf("%d",&n); while(n--) { memset(a,0,sizeof(a)); a[2]=1; scanf("%d",&m); while(m--) { scanf("%d%d",&x,&y); ... 阅读全文
posted @ 2012-05-14 20:32 LegendaryAC 阅读(181) 评论(0) 推荐(0)

上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 19 下一页