#include
#include
#include
#include
#include
#include
using namespace std;
typedef long long LL;
inline int read(){
int x = 0,f = 1; char ch = getchar();
while(ch '9'){if(ch == '-')f=...
分类:
其他好文 时间:
2014-11-04 21:15:02
阅读次数:
166
#include
using namespace std;
int a[10][10];
void foo(int n)
{
int m=1;
int i,j;
for(i=0;i<n/2;++i)
{
for(j=0;j<n-i;++j)
{
if(a[i][j]==0)
a[i][j]=m++;
}
for(j=i+1;j<n-i;++j)
{
...
分类:
编程语言 时间:
2014-11-04 21:14:06
阅读次数:
1010
题目地址:HDU 3622
先二分半径,然后小于该半径的不能选,对这些不能选的点对进行加边。然后判断可行性即可。
代码如下:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#d...
分类:
其他好文 时间:
2014-11-04 21:12:55
阅读次数:
221
很简单的一道题,就是要我们求出最受大家欢迎的题所对应的气球颜色.......
代码如下:
#include
#include
#include
#include
using namespace std;
char str[1314][20];
int n,cnt[1314];
int main()
{
while(cin>>n)
{
if(!n)...
分类:
其他好文 时间:
2014-11-04 21:12:27
阅读次数:
139
POJ 3358 Period of an Infinite Binary Expansion( 数论好题 + 欧拉定理 + 欧拉函数 )#include #include #include #include using namespace std;typedef long long LL;LL f...
分类:
其他好文 时间:
2014-11-04 21:07:26
阅读次数:
167
题目:poj 2553 The Bottom of a Graph
题意:大概题意是给出一个有向图,求强连通缩点以后出度为0的点。
分析:入门题目,先强连通缩点,然后表示出度为0的,枚举输出即可。
#include
#include
#include
#include
#include
using namespace std;
const int N = ...
分类:
其他好文 时间:
2014-11-04 19:50:21
阅读次数:
172
C/C++
http://wenku.baidu.com/view/9e6f4548852458fb770b56c7.html
#include
#include
using namespace std;
int main() {
clock_t start, finish;
double totalTime;
start = clock(); ...
分类:
编程语言 时间:
2014-11-04 19:49:07
阅读次数:
247
题目:poj 2186 Popular Cows
题意:n头牛,其中存在一些牛相互崇拜,具有传递性,问有多少头牛是被其他所有牛崇拜的。
分析:建立一个有向图,然后强连通缩点,之后求出度为0的点,假如存在多个,那么ans = 0,因为缩点之后如果x崇拜y,x也崇拜z,那么肯定y和z不能互相崇拜,不满足。
然后求出度为0的这个点缩点前环上有多少个点就ans
AC代码:
...
分类:
其他好文 时间:
2014-11-04 19:44:59
阅读次数:
236
#include
#include
#define N 30000
using namespace std;
int a[N+1],o=0;
typedef struct
{
int weight;
int parent,lchild,rchild;
}htnode;
typedef struct
{
int weight;
}htcode;
void huffmanselect(htno...
分类:
其他好文 时间:
2014-11-04 19:42:45
阅读次数:
397
枚举一个串的所有子串,和其余的串匹配,裸kmp的题。
#include
#include
#include
using namespace std;
const int maxn = 222;
const int maxd = 4010;
int f[maxn];
char str[maxn];
char t_str[maxn];
char c_str[maxd][maxn];
void ini...
分类:
其他好文 时间:
2014-11-04 19:39:40
阅读次数:
234