- 博客(20)
- 收藏
- 关注
原创 【POJ - 3270 】Cow Sorting 【置换群 序列变升序最小花费】
Farmer John’s N (1 ≤ N ≤ 10,000) cows are lined up to be milked in the evening. Each cow has a unique “grumpiness” level in the range 1…100,000. Since grumpy cows are more likely to damage FJ’s milking
2017-11-22 00:25:37 284
原创 【CodeForces - 894】 A【暴力】B【思维+欧拉降幂】C【构造+思维】
A - QAQ “QAQ” is a word to denote an expression of crying. Imagine “Q” as eyes with tears and “A” as a mouth.Now Diamond has given Bort a string consisting of only uppercase English letters of length
2017-11-21 22:49:31 515
原创 【LightOJ - 1116】Ekka Dokka 【算数基本定理】
Ekka and his friend Dokka decided to buy a cake. They both love cakes and that’s why they want to share the cake after buying it. As the name suggested that Ekka is very fond of odd numbers and Dokka i
2017-11-17 08:34:27 338
原创 【HDU - 4196】Remoteland 【逆元+算数基本定理】
In the Republic of Remoteland, the people celebrate their independence day every year. However, as it was a long long time ago, nobody can remember when it was exactly. The only thing people can rememb
2017-11-13 21:39:01 350
原创 【HDU- 4648】 Magic Pen 6 【思维 】
In HIT, many people have a magic pen. Lilu0355 has a magic pen, darkgt has a magic pen, discover has a magic pen. Recently, Timer also got a magic pen from seniors. At the end of this term, teacher giv
2017-11-13 17:01:27 296
原创 【POJ - 2409 && POJ - 1286 】 【polya定理】【旋转 or 翻转 详解】
这两个题目就是一个题目。 题意: 有一个长度为n的项链,现在给m个颜色的珠子,每种的珠子个数都是无限个,现在问你能够做成几个本质不同的项链(如果两个项链不能够通过旋转或者翻转达到相同,则认为本质不同) 。 在做这个题目之前最好把群相关的知识点看看。 分析 : 现在给了两种操作可能使项链相同 , 翻转和旋转。 我们一个个来分析。1 》 旋转 首先旋转的话,可能会旋转一个珠子,旋转两个珠子,
2017-11-11 11:50:39 476
原创 【 CodeFors 877 】 A B
A Div. 64 Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills.Her problem is following: for given string, consisting of only 0 and 1, tell
2017-11-09 21:30:32 380
原创 【舞伴问题 -- 链队列实现】
数据结构作业记录 如有BUG ,欢迎指出!!#include<bits/stdc++.h> using namespace std; #define status int #define OK 1 #define ERROR 0 typedef struct QNode{ int sex; char name[100]; struct QNode *next; }QN
2017-11-09 13:58:37 2648
原创 【HDU - 5929】 Basic Data Structure 【双向链表+模拟】
Mr. Frog learned a basic data structure recently, which is called stack.There are some basic operations of stack: ∙∙ PUSH x: put x on the top of the stack, x must be 0 or 1. ∙∙ POP: throw the element
2017-11-08 23:09:22 225
原创 【HDU - 5927】 Auxiliary Set 【DFS +思维】
Mr. Frog learned a basic data structure recently, which is called stack.There are some basic operations of stack: ∙∙ PUSH x: put x on the top of the stack, x must be 0 or 1. ∙∙ POP: throw the element
2017-11-08 18:30:28 296
原创 【表达式求值---链栈处理】
数据结构作业记录。 如有BUG ,欢迎指出 !! #include<iostream> #include<cstring> #include<cstdio> #include<cmath> using namespace std; #define status int #define OK 1 #define ERROR 0 struct Node1{ // 存储操作数的栈 do
2017-11-05 12:28:28 901
原创 【HDU - 139】Square Coins 【母函数】
People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e., 1-credit coins, 4-cred
2017-11-04 00:06:51 421
原创 【HDU - 1028 】Ignatius and the Princess III 【母函数】
“Well, it seems the first problem is too easy. I will let you know how foolish you are later.” feng5166 says. “The second problem is, given an positive integer N, we define an equation like this: N
2017-11-03 23:56:47 252
原创 【Gym - 101350G】Snake Rana 【状态压缩 +容斥定理】
Old Macdonald wants to build a new hen house for his hens. He buys a new rectangular area of size N by M. The night before he builds the hen house, snake Rana devises an evil plan to plant bombs in K d
2017-11-03 23:01:25 278
原创 【SPOJ - COT】Count on a tree 【主席树 求静态树上第k大】
You are given a tree with N nodes. The tree nodes are numbered from 1 to N. Each node has an integer weight.We will ask you to perform the following operation:u v k : ask for the kth minimum weight on
2017-11-02 18:28:14 228
原创 【POJ - 2104】K-th Number 【主席树 求静态区间第k大】
You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a new data structure that would be able to return quick
2017-11-02 13:51:55 194
原创 【POJ - 2761】Feed the dogs 【主席树 求静态区间第k大】
Wind loves pretty dogs very much, and she has n pet dogs. So Jiajia has to feed the dogs every day for Wind. Jiajia loves Wind, but not the dogs, so Jiajia use a special way to feed the dogs. At luncht
2017-11-02 13:20:51 260
原创 【HDU - 4757】Tree 【LCA+持久化01 Trie】
Zero and One are good friends who always have fun with each other. This time, they decide to do something on a tree which is a kind of graph that there is only one path from node to node. First, Zero w
2017-11-02 00:15:58 285
原创 【HDU - 4549 】M斐波那契数列 【矩阵快速幂+费马小定理降幂】
M斐波那契数列F[n]是一种整数数列,它的定义如下: F[0] = a F[1] = b F[n] = F[n-1] * F[n-2] ( n > 1 ) 现在给出a, b, n,你能求出F[n]的值吗? Input 输入包含多组测试数据; 每组数据占一行,包含3个整数a, b, n( 0 <= a, b, n <= 10^9 ) Output 对每组测试数据请输出一个整数F[n
2017-11-01 17:22:09 248
原创 【HDU - 4704】Sum 【隔板法+费马小定理降幂】
分析: 我们可以将n划分为n 个1,然后我们分1就行了。 s(k) 为 从n-1个空中插入k-1个隔板,即C(n-1,k-1),现在要求C(n-1,0)+C(n-1,1)+C(n-1,2)…+C(n-1,n-1) ,由二项式定理公式 C(n,0)+C(n,1)+C(n,2)…C(n,n)= 2^n. 可知我们要求的是2^(n-1) 但是题目中的N太大了,无法计算,所有我们可以用费马小定理降幂,
2017-11-01 16:15:32 283
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人