题意:求[a,b]与n互质的个数
思路:容斥原理的运用,提取n的素因子,先算出不与n互素的个数,容斥原理奇加偶减
#include
#include
#include
#include
#define ll long long
using namespace std;
const int MAXN = 70;
ll prime[MAXN];
ll a,b,n;
ll make(l...
分类:
其他好文 时间:
2014-07-22 23:05:55
阅读次数:
315
#include #include #include #include #include
#define BUFF_LEN 1024using namespace std;long file_len(string file_name);void
init(string file_name){}voi...
分类:
其他好文 时间:
2014-07-22 23:00:54
阅读次数:
190
本文出自:http://blog.csdn.net/svitter
题意:汉诺塔,多了一根柱子,问你寻找最快的移动次数。
dp [ n ] = dp [ n - j ] * 2 + pow( 2, j ) - 1;
就是把j个汉诺塔移到一根上,然后就是普通的汉诺塔问题,即2^n - 1次移动。
注意pow(2, j )可能超出long long int范围。写二的次方的时候也可用移...
分类:
其他好文 时间:
2014-05-03 00:14:10
阅读次数:
342
2-SAT入门题,将两个队员看成一个点即可,即用一条边将两个队员连起来,然后就是2-SAT裸题。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define M 3005
#define LL long long
#def...
分类:
其他好文 时间:
2014-05-02 18:40:29
阅读次数:
288
题目题意:给定a, b, x, y; 求使c, d; 使c:d = x :y; 且c 2
#include 3 #include 4 #include 5 using namespace std; 6 7 long long gcd(long
long a, long long b) 8 {...
分类:
其他好文 时间:
2014-05-01 19:30:04
阅读次数:
372
注意变换思维,然后就是水题。(如果卡时还可以进一步二分优化。)#include long
existed[10000][32];int main(void){ int N;// freopen("poj2443.txt", "r", stdin);
scanf("%d", &N);...
分类:
其他好文 时间:
2014-05-01 09:15:47
阅读次数:
373
首先,让我们看一看Android
Log的格式。下面这段log是以所谓的long格式打印出来的。从前面Logcat的介绍中可以知道,long格式会把时间,标签等作为单独的一行显示。
[ 12-09 21:39:35.510
396: 416 I/ActivityManager ]
Start proc
net.coollet.infzmreader:umengService_v1 for...
分类:
移动开发 时间:
2014-04-30 22:18:39
阅读次数:
523
long long定义方式可以用于gcc/g++,不受平台限制,但不能用于VC6.0。__int64是Win32平台编译器64位长整型的定义方式,不能用于Linux。“%lld”用于Linux i386平台编译器,”%I64d”用于Win32平台编译器。cout只能用于C++编译,在VC6.0中,cout不支持64位长整型。...
分类:
其他好文 时间:
2014-04-29 13:35:21
阅读次数:
309
long switchState = 0xf0000000000L;
int result = (switchState & 0xff00000000L) > 0 ? 0x01 : 0x00;
你觉得result是多少?1
result = (switchState & 0xff000000) > 0 ? 0x01 : 0x00;
你觉得result是多少?1 【还是没有完...
分类:
编程语言 时间:
2014-04-29 13:24:21
阅读次数:
323
Aggressive cows
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 5436
Accepted: 2720
Description
Farmer John has built a new long barn, with N (2 <= N <= 100,...
分类:
其他好文 时间:
2014-04-29 13:22:21
阅读次数:
304