
算法---数论
文章平均质量分 53
老顽童灬
我是渣渣
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Co-prime——容斥原理
转载网址: 点击打开链接 点击打开题目 Co-prime Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3495 Accepted Submission(s): 1381 Proble转载 2017-07-30 20:43:56 · 950 阅读 · 0 评论 -
矩阵(加法&&乘法&&快速幂)
矩阵相乘:#include<cstdio> int main() { int m1,m2,n1,n2; int t; int a[105][105]; int b[105][105]; int c[105][105]; scanf("%d",&t); while(t--) { scanf("%d%d",&m1,&n1);原创 2017-08-15 15:39:50 · 410 阅读 · 0 评论 -
A-B Game --贪心
Fat brother and Maze are playing a kind of special (hentai) game by two integers A and B. First Fat brother write an integer A on a white paper and then Maze start to change this integer. Every time M转载 2017-08-03 20:52:57 · 294 阅读 · 0 评论 -
Trailing Zeroes (III)
点击打开链接 You task is to find minimal natural number N, so that N! contains exactly Q zeroes on the trail in decimal notation. As you know N! = 1*2*...*N. For example, 5! = 120, 120 contains one zero原创 2017-07-27 16:41:45 · 184 阅读 · 0 评论 -
Relatives---欧拉函数
点击打开链接 Given n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if there are no integers x > 1, y > 0, z > 0原创 2017-07-30 11:13:39 · 211 阅读 · 0 评论 -
吃糖果——抽屉原理
Problem Description HOHO,终于从Speakless手上赢走了所有的糖果,是Gardon吃糖果时有个特殊的癖好,就是不喜欢将一样的糖果放在一起吃,喜欢先吃一种,下一次吃另一种,这样;可是Gardon不知道是否存在一种吃糖果的顺序使得他能把所有糖果都吃完?请你写个程序帮忙计算一下。 Input 第一行有一个整数T,接下来T组数据,每组数据占2原创 2017-07-30 11:17:22 · 218 阅读 · 0 评论 -
分解质因数代码
分解质因数: #include #include #include using namespace std; int pr(int n) { for(int i=2;i { if(n%i==0) { n/=i; printf("%d ",i); while(n%i==0) { n/=i; printf("%d ",i); } } } if(n>1)原创 2017-07-30 16:26:01 · 2062 阅读 · 0 评论 -
博弈
转载网址:点击打开链接 最近见得博弈太多于是学习了一下 一个不错的PPT 传送门 巴什博弈 问题:只有一堆n个物品,两个人轮流从这堆物品中取物,规定每次至少取一个,最多取m个,最后取光者得胜。 公式:n%(m+1)!=0 当一个人要面对(m+1)的倍数时一定会输,另一个人只需一直让物品保持为n的倍数 减法博弈 巴什博弈有一种变形,叫做减法博弈。用s表示转载 2017-07-27 09:00:08 · 320 阅读 · 0 评论 -
Subsequence --二分法
A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal length of the sub原创 2017-07-27 16:30:30 · 208 阅读 · 0 评论 -
The Frog's Games
点击打开题目 给你一个传送门:点击打开链接 The Frog's Games Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others) Total Submission(s): 5707 Accepted Submission(s): 2748 Prob转载 2017-07-27 19:44:47 · 528 阅读 · 0 评论 -
最大公约数--最小公倍数
#include<cstdio> #include<cstring> int zdgys(int a,int b)//辗转相除法 { int t; while(b) { t=b; b=a%b; a=t; } return t; } int zxgbs(int a,int b)//两个数的最小公倍数== 两个数相原创 2017-12-05 21:15:04 · 250 阅读 · 0 评论