
acm基础
Drac青螭
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
算法实验4:棋盘覆盖
棋盘覆盖问题 Description 在一个2k x 2k 个方格组成的棋盘中,恰有一个方格与其他方格不同,称该方格为一特殊方格,且称该棋盘为一特殊棋盘。在棋盘覆盖问题中,要用图示的4种不同形态的L型骨牌覆盖给定的特殊棋盘上除特殊方格以外的所有方格,且任何2个L型骨牌不得重叠覆盖。 Input k,dr,dc。k定义如前,dr,dc分别表示特殊方格所在的行号和列号 1= < k < =6 Output 按照左上,右上,左下,右下的顺序用分治法求解。特殊方格标0,其他位置按上述顺序依次标记。 Sa原创 2020-09-10 08:16:05 · 602 阅读 · 0 评论 -
算法实验1:x^n mod 1003
算法实验1:x^n mod 1003 题目描述 Description 给定整数x和n,求x的n次幂 mod 1003 Input 整数x和n。 1<=x,n<=1,000,000,0000 Output x^n mod 1003 Sample Input 2 10 Sample Output 21 分析 幂函数,x^n,当数值过大时,需要进行处理 这里用了一种思想,首先将n转换成二进制数值,例如x^10,这里将(10)转换成(1010) 从左边高位数值第一位进行舍弃,初始(xx),依次判断,如原创 2020-09-03 09:16:55 · 2046 阅读 · 0 评论 -
奇特的数
1.斐波那契数列: 问题: 常见的就是兔子问题:如果一对兔子每月能生一对小兔(一雄一雌),而每对小兔在牠出生后的第三个月里,又能开始生一对小兔,假定在不发生死亡的情况下,由一对出生的小兔开始,50个月后会有多少对兔子? 从第一个月开始以后每个月的兔子总数是1,1,2,3,5,8,13,21,34,55,89,144,233…,所以当n>1时,Fn+2 = Fn+1+Fn,而F0=F1=1。 黄金分...原创 2019-10-16 18:44:54 · 259 阅读 · 0 评论 -
acm.小节
Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever faced was keeping himself alive. In order for him to survive, he decided to create one of the first ...原创 2019-09-10 19:40:19 · 261 阅读 · 0 评论 -
The Hardest Problem Ever
Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever faced was keeping himself alive. In order for him to survive, he decided to create one of the first ...原创 2019-10-09 15:51:48 · 270 阅读 · 0 评论 -
算法:x^n
Description 问题很简单,求x^n.请编写pow()函数. 声明如下: int pow(int x,int n,int p) //pow的功能是实现x^n,最后1个参数p没有用。 系统会自动在程序的最后加上如下代码: int main() { int x,n; scanf("%d %d",&x,&n); printf("%d\n",pow(x,n,1)); return ...原创 2019-10-09 16:03:21 · 990 阅读 · 0 评论 -
Holding Bin-Laden Captive!
Holding Bin-Laden Captive! Description We all know that Bin-Laden is a notorious terrorist, and he has disappeared for a long time. But recently, it is reported that he hides in Hang Zhou of China! “O...原创 2019-10-11 18:46:41 · 164 阅读 · 0 评论