随笔分类 -  二进制相关

sgu 249 Matrix
摘要:249. Matrixtime limit per test: 1 sec.memory limit per test: 65536 KBinput: standardoutput: standardIt is necessary to arrange numbers from 0 to 2^(N+M)-1 in the matrix with 2^N rows and 2^M columns. Moreover, numbers occupying two adjacent cells must differ only in single bit in binary notation. Ce 阅读全文

posted @ 2012-10-25 12:30 江财小子 阅读(331) 评论(0) 推荐(0)

POJ 1845 Sumdiv
摘要:SumdivTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 10515Accepted: 2477DescriptionConsider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of S by 9901).InputThe only line contains the two natural numbers A an 阅读全文

posted @ 2012-10-22 23:52 江财小子 阅读(198) 评论(0) 推荐(0)

xmu 1254.异或求和
摘要:1254.异或求和 Time Limit: 1000 MS Memory Limit: 65536 K Total Submissions: 52 (19 users) Accepted: 13 (7 users) Description给你2个区间[A,B]和[C,D],现在只要求你求出区间[A,B]和[C,D]内任意2个整数异或后的和,因为答案可能会很大,你只需将结果%mod即可。For(i:A→B) For(j:C→D) Sum += (i^j);Input输入第一行为T(T=2^(k-1) 的 x 第k位就是1这样只要求出 x某个范围 ,其它就是它的等价类了这... 阅读全文

posted @ 2012-10-22 15:35 江财小子 阅读(1877) 评论(0) 推荐(0)

hdu 2175 汉诺塔IX
摘要:汉诺塔IXTime Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 404Accepted Submission(s): 235Problem Description1,2,...,n表示n个盘子.数字大盘子就大.n个盘子放在第1根柱子上.大盘不能放在小盘上. 在第1根柱子上的盘子是a[1],a[2],...,a[n]. a[1]=n,a[2]=n-1,...,a[n]=1.即a[1]是最下 面的盘子.把n个盘子移动到第3根柱子.每次只能移动1个盘子,且 阅读全文

posted @ 2012-07-21 20:20 江财小子 阅读(223) 评论(0) 推荐(0)

POJ 3641 Pseudoprime numbers
摘要:Pseudoprime numbersTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4864Accepted: 1872DescriptionFermat's theorem states that for any prime number p and for any integer a > 1, ap = a (mod p). That is, if we raise a to the pth power and divide by p, the remainder is a. Some (but not ve 阅读全文

posted @ 2012-07-06 19:54 江财小子 阅读(262) 评论(0) 推荐(0)

NYOJ 102 次方求模
摘要:描述求a的b次方对c取余的值输入第一行输入一个整数n表示测试数据的组数(n<100)每组测试只有一行,其中有三个正整数a,b,c(1=<a,b,c<=1000000000)输出输出a的b次方对c取余之后的结果样例输入32 3 53 100 1011 12345 12345样例输出3110481#include <iostream>#include <cstdio>using namespace std;int main(){ long long int a,b,c,t; int T; scanf("%d",&T); whil 阅读全文

posted @ 2012-04-23 22:29 江财小子 阅读(204) 评论(0) 推荐(0)

3006 HDU The Number of set
摘要:http://www.cnblogs.com/lonelycatcher/archive/2011/05/27/2060158.htmlGiven you n sets.All positive integers in sets are not less than 1 and not greater than m.If use these sets to combinate the new set,how many different new set you can get.The given sets can not be broken.InputThere are several case 阅读全文

posted @ 2012-03-29 17:06 江财小子 阅读(232) 评论(0) 推荐(0)