日积月累
文章平均质量分 50
jz-nice
这个作者很懒,什么都没留下…
展开
-
zoj 1154 Niven Numbers
思路:先转为十进制的数,在按照题目要求判断 本题转为进制的方法示例,如将八进制的231转换为十进制, ((0*8+2)*8+3)*8+1 =(2*8 + 3)*8 +1 = 2*8²+3*8+1 #include #include int main() { int n,b;//b表示进制 char s[100]; scanf("%d",&n); wh原创 2013-07-08 18:42:28 · 1166 阅读 · 0 评论 -
zoj 1152 A Mathematical Curiosity
方法:枚举 做这道题,在第十行的位置WA了很多次,(n || m)不能写成(n + m),m可能是负数,一直没注意到,导致不停的WA....... #include int main() { int T,n,m,a,b,ans,p = 0; scanf("%d",&T); while(T--) { if(p ++) printf("\n");原创 2013-07-08 16:56:33 · 794 阅读 · 0 评论 -
hdu 2095 find your present (2)(位异或)
题目链接:hdu2095 位异或的运算法则: 1、a^b = b^a 2、(a^b)^c = a^(b^c) 3、a^b^a = b。 对于一个任意一个数n: 1、0^n = n。 2、n^n = 0。 不断的位异或运算,剩下的就是出现奇数次的那个数 #include int main() { int n; while(scanf("%d",原创 2013-07-30 18:21:52 · 897 阅读 · 0 评论 -
hdu 1285 确定比赛名次(拓扑排序)
题目链接:hdu1285 拓扑排序,但题目要求按序号排出,按普通的拓扑排序不行,所以就每次从前往后搜 #include #include #include using namespace std; int map[505][505]; int ans[505],du[505]; int n,i,j; void toposort() { for(i = 1 ; i <= n ; i ++原创 2013-07-23 15:46:07 · 836 阅读 · 0 评论 -
hdu 1381 Crazy Search(hash)
题目链接:hdu1381 第一次做hash题目,看的别人的思路,先将字符串传为数学,然后每一段数字(长度为n)转换为m进制的数,再判断是否重复 #include #include #define N 16000005 char a[N]; int cnt[N]; int hash[8000000],d[28]; int ans,n,m; void hashs() { int i,j,k原创 2013-07-26 10:21:43 · 855 阅读 · 0 评论 -
hdu4268(贪心+set容器)
题目链接:hdu4268 /* 题意:Alice和Bob有很多卡片,Alice想用自己的卡片覆盖Bob的卡片; 如果一张卡片的h和w都大于等于另一张,则可以覆盖,每张卡片只能用一次, 且卡片不能旋转 思路:贪心+set容器 每次A的卡片覆盖B的卡片时,找A刚好能覆盖的那一张B卡片 */ #include #include #include #include #include #inc原创 2014-05-22 17:17:45 · 706 阅读 · 0 评论