题意:求[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
MATLAB大法好
Time Limit: 8000ms
Memory Limit: 65536KB
64-bit integer IO format: %lld Java class name: Main
MATLAB大法好,天灭C++,退C保平安,人在做,天在看,大段循环留祸患,内存泄露电脑灭,跳出递归保平安。诚心诚念矩阵好,批量操作平安保,两行代码...
分类:
其他好文 时间:
2014-07-22 23:03:14
阅读次数:
374
与VB相比,VB.NET在错误处理上也有了很大的改进,下面来谈一谈异常处理和及其用于捕捉错误的有效的编程方法。
On Error语句
VB.NET仍然包含了VB中的On Error语句,当考虑全局错误处理的时候,可以采用这种方法。下面是实例
On Error GoTo errorhandler
Dim intx As Integer...
分类:
Web程序 时间:
2014-07-22 23:03:12
阅读次数:
378
#include #include using namespace std; struct
BTNode { int v; // default positive Integer. BTNode *pLeft; BTNode *pRight;
BTNode(int x) : v(x), pLeft(...
分类:
其他好文 时间:
2014-07-22 23:00:54
阅读次数:
294
#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
ComboBoxPropertyDescriptor
1、public void setPropertyValue(Object id, Object value)
value为ComboBox中值的序号,而不是ComboBox中显示的名字.
2、public Object getPropertyValue(Object id)
返回的是序号需要转换为Integer类型。否则可能不显示可...
分类:
其他好文 时间:
2014-05-01 22:02:53
阅读次数:
387
Determine whether an integer is a palindrome.
Do this without extra space.Some hints:Could negative integers be palindromes?
(ie, -1)If you are thinki...
分类:
其他好文 时间:
2014-05-01 19:48:19
阅读次数:
344
题目题意:给定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
首先,让我们看一看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