ACM_数论
chudongfang2015
开心开心!!!!!!
展开
-
Endless Punishment——HOJ
A - Endless PunishmentTime Limit:15000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionIn the ancient Greek tale, Sisyphus was a king of Ephyra, h转载 2016-06-05 09:56:50 · 543 阅读 · 0 评论 -
Wannafly挑战赛5 D题题解 数学
时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld题目描述给定一个小写字母字符串T求有多少长度为m的小写字母字符串S满足,T是S的一个子序列(不需要连续)输入描述:第一行一个字符串T第二行一个正整数m输出描述:输出答案对109+7取模的值原创 2017-12-08 23:53:41 · 581 阅读 · 0 评论 -
B. Coin 数学/组合数 2017 ACM-ICPC 亚洲区(西安赛区)网络赛
Bob has a not even coin, every time he tosses the coin, the probability that the coin's front face up is \frac{q}{p}(\frac{q}{p} \le \frac{1}{2})pq(pq≤21).The question is, when Bob原创 2017-09-20 22:29:22 · 425 阅读 · 0 评论 -
C. Sum 数学/规律 2017 ACM-ICPC 亚洲区(西安赛区)网络赛
题目链接Define the function S(x)S(x) for xx is a positive integer. S(x)S(x) equals to the sum of all digit of the decimal expression of xx. Please find a positive integer kk that S(k*x)\%233=0S(k∗x)%233=0.原创 2017-09-20 22:25:46 · 304 阅读 · 0 评论 -
862C C. Mahmoud and Ehab and the xor XOR操作/构造
题目链接大神题解://解题思路:重点就是抓住异或的性质,两个相同的数异或等于0, //任何数异或0结果都不变。意思就是例如 3^4^5^3^4^5^6=6 。 //然后这道题就很简单了。假设我们要使最后的结果为X,大小为4, //那么我们可以 a^b^c^(a^b^c)^x=x,其中四个数分别为, //a,b,c,(a^b^c)。但是a^b^c可能等于a,b,c中的一个数, //所原创 2017-09-20 21:55:24 · 684 阅读 · 0 评论 -
HDU 6216 A Cubic number and A Cubic Number 公式/打表 [2017 ACM/ICPC Asia Regional Qingdao Online]
Problem DescriptionA cubic number is the result of using a whole number in a multiplication three times. For example, 3×3×3=27 so 27 is a cubic number. The first few cubic numbers are 1,8,27,64 and 125原创 2017-09-20 11:39:57 · 322 阅读 · 0 评论 -
Frequent Subsets Problem 进制运算 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛
题目链接因为n只到20,直接利用二进制的位运算暴力解决,1代表有该元素,0代表没有该元素#include<bits/stdc++.h>using namespace std;typedef long long ll;int n;double m;stringstream ss;string s;int t;int c[55];int sum=0;int main(){//原创 2017-09-25 10:58:58 · 335 阅读 · 0 评论 -
Nim博弈论变型
分为3堆和三堆的规律相似2^n堆sg[8*k+7] = 8k+8;sg[8*k+8] = 8k+7;sg[4k+3]=4k+4; sg[4k+4]=4k+3;C - A Simple NimTwo players take turns picking candies from n heaps,the player who picks the last one will win the gam原创 2017-08-05 22:33:30 · 436 阅读 · 0 评论 -
组合博弈 -- 三大基本博弈
这几天开始学习博弈,发现这一块是个难啃的骨头。以下是我从网上收集的资料汇总: 我国民间有个古老的游戏:就是有物品若干堆,(物品可以是火柴,围棋都可以)。两个人轮流从堆中取若干件,规定取光物体者为胜。这个就是我们今天要研究的组合游戏。组合游戏定义: 1、有且仅有两个玩家 2、游戏双方轮流操作 3、游戏操作状态是个有限的集合(比如:取石子游戏,石子是有限转载 2017-08-05 21:57:11 · 300 阅读 · 0 评论 -
组合游戏 - SG函数和SG定理
http://blog.csdn.net/luomingjun12315/article/details/45555495 在介绍SG函数和SG定理之前我们先介绍介绍必胜点与必败点吧.必胜点和必败点的概念: P点:必败点,换而言之,就是谁处于此位置,则在双方操作正确的情况下必败。 N点:必胜点,处于此情况下,双方操作均正转载 2017-08-05 19:31:06 · 357 阅读 · 0 评论 -
Stirling数概念及例题
第一类Stirling数 s(p,k) s(p,k)的一个的组合学解释是:将p个物体排成k个非空循环排列的方法数。s(p,k)的递推公式: s(p,k)=(p-1)*s(p-1,k)+s(p-1,k-1) ,1<=k<=p-1 边界条件:s(p,0)=0 ,p>=1 s(p,p)=1 ,p>=0递推关系的说明: 考虑第p个物品,p可以单独构成一个非空循环排列,这样前p-1种物品构成k-原创 2017-08-10 23:01:38 · 1681 阅读 · 0 评论 -
HDU 4565矩阵快速幂—— So Easy!
题目链接借鉴别人的一张解题思路 转化成了 (a^n + b^n) %M#include<iostream>#include<string>#include<vector>#include<algorithm>#include<queue>#include<cstdio>#include<cstring>#include<cmath>#include<map>using names原创 2017-08-09 22:05:02 · 366 阅读 · 0 评论 -
欧拉降幂公式—— BZOJ 3884 && FZU 1759
C - Super A^B mod CGiven A,B,C, You should quickly calculate the result of A^B mod C. (1<=A,C<=1000000000,1<=B<=10^1000000).Input There are multiply testcases. Each testcase, there is one line cont原创 2017-08-08 17:58:13 · 762 阅读 · 0 评论 -
费马小定理—— HDU4704 Sum
费马小定理:假如p是素数,且a与p互质,那么a^(p-1) = 1 (mod p)。应用:说明了模素数的指数是有循环节的,且循环节长度为p-2,减少运算量2^n%m == ( 2^(n%(m-1))* 2^(n/(m-1)*(m-1)) )%m == (2^(n%(m-1)))%m * ((2^k)^(m-1))%m == (2^(n%(m-1)))%m * 1 == (2^(n%(m原创 2017-08-08 16:31:41 · 341 阅读 · 0 评论 -
假期训练——OpenJ_Bailian - 1833 排列 全排序
题目描述: 大家知道,给出正整数n,则1到n这n个数可以构成n!种排列,把这些排列按照从小到大的顺序(字典顺序)列出,如n=3时,列出1 2 3,1 3 2,2 1 3,2 3 1,3 1 2,3 2 1六个排列。 任务描述: 给出某个排列,求出这个排列的下k个排列,如果遇到最后一个排列,则下1排列为第1个排列,即排列1 2 3…n。 比如:n = 3,k=2 给出排列2原创 2017-01-24 22:47:32 · 310 阅读 · 0 评论 -
Codeforces Round #272 (Div. 2) < math >
A Dreamoon and Stairs 数学水题题目思路:判断一下m的倍数的两倍是否大于n.代码#include <iostream> #include <cstdio>#include <cstdlib>#include <cmath>#include <iomanip>#include <algorithm>#include <climits>#include <cstring原创 2017-02-13 17:37:57 · 331 阅读 · 0 评论 -
Codeforces 768C Jon Snow and his Favourite Number
C. Jon Snow and his Favourite Numbertime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputJon Snow now has to fi原创 2017-02-21 10:09:45 · 2097 阅读 · 0 评论 -
Codeforces 768B Code For 1
B. Code For 1time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputJon fought bravely to rescue the wildlings wh原创 2017-02-21 10:06:24 · 568 阅读 · 0 评论 -
Aladdin and the Flying Carpet LightOJ - 1341 数论/唯一分解定理
题目链接可以利用唯一分解定义求出有多少个约数,然后再减去小于b的.我直接求出了约数,然后计算,比较耿直~~#include<bits/stdc++.h>using namespace std;typedef long long ll;const ll INF = 1e18;const int N = 1000004;int isprime[1000005];int prime[100原创 2017-12-09 00:15:19 · 267 阅读 · 0 评论