题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2028题目大意:求最小公倍数,用辗转相除法。 1 #include 2 int main () 3 { 4 int gcd(int a,int b); 5 int a,b,n,i,c; ...
分类:
其他好文 时间:
2014-07-18 17:37:40
阅读次数:
305
UVA 10294 - Arif in Dhaka (First Love Part 2)
题目链接
题意:给定n个珠子,t种颜色, 问能组成几个项链和手镯(手镯能翻转,项链不能)
思路:利用Burnside求解,推理出旋转的循环个数是gcd(i, n),翻转的分为奇偶情况考虑
代码:
#include
#include
const int N = 30;
in...
分类:
其他好文 时间:
2014-07-18 15:12:41
阅读次数:
215
UVA 12103 - Leonardo's Notebook
题目链接
题意:给定一个字母置换B,求是否存在A使得A^2=B
思路:任意一个长为 L 的置换的k次幂,会把自己分裂成gcd(L,k) 分, 并且每一份的长度都为 L / gcd(l,k),因此平方对于奇数长度不变,偶数则会分裂成两份长度相同的循环,因此如果B中偶数长度的循环个数不为偶数必然不存在A了
代码:
...
分类:
其他好文 时间:
2014-07-18 15:12:10
阅读次数:
300
```objc#import "ViewController.h"@interface ViewController ()@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *action;@end@implementation ...
分类:
其他好文 时间:
2014-07-18 14:26:27
阅读次数:
247
```objc#import "ViewController.h"int threadNumber = 0;int newThingNumber = 0;@interface ViewController ()@end@implementation ViewController- (void)vie...
分类:
其他好文 时间:
2014-07-18 14:23:25
阅读次数:
229
【原题】
3333: 排队计划
Time Limit: 20 Sec Memory Limit: 128 MB
Submit: 161 Solved: 71
[Submit][Status]
Description
Input
Output
Sample Input
6 2
160 163 164 161 167 160 ...
分类:
其他好文 时间:
2014-07-18 14:07:18
阅读次数:
288
GCD为Grand Central Dispatch的缩写。 Grand Central Dispatch (GCD)是Apple开发的一个多核编程的较新的解决方法。在Mac OS X 10.6雪豹中首次推出,并在最近引入到了iOS4.0。 GCD是一个替代诸如NSThread等技术的很高效和强.....
分类:
移动开发 时间:
2014-07-18 12:07:40
阅读次数:
324
题解:n为树的节点数,d[ ]为各节点的度数,m为无限制度数的节点数。则所以要求在n-2大小的数组中插入tot各序号,共有种插法;在tot各序号排列中,插第一个节点的方法有种插法;插第二个节点的方法有种插法; .........另外还有m各节点无度数限制,所以它们可任意排列在剩余的n-2-tot的空...
分类:
其他好文 时间:
2014-07-18 08:06:12
阅读次数:
324
2243: [SDOI2011]染色Time Limit: 20 SecMemory Limit: 512 MBSubmit: 1886Solved: 752[Submit][Status]Description给定一棵有n个节点的无根树和m个操作,操作有2类:1、将节点a到节点b路径上所有点都染成...
分类:
其他好文 时间:
2014-07-17 22:08:09
阅读次数:
553
题解:数据结构的基本操作,用STL可以完美实现,就是比较慢……#include #include #include #include #include const int MAXN=500005; const int INF=~0U>>1; using namespace std; ...
分类:
其他好文 时间:
2014-07-17 17:39:20
阅读次数:
193