没有合适的资源?快使用搜索试试~ 我知道了~
ACM算法总结
需积分: 10 3 下载量 190 浏览量
2019-05-08
13:34:55
上传
评论
收藏 143KB DOCX 举报
温馨提示
试读
64页
我总结的ACM算法吧,不知道会不会对后来者有用,但是,我既然花了这么多时间总结一份文档,总不想让它浪费,虽然有不足之处,但是还是想让它存在这互联网之海中。
资源推荐
资源详情
资源评论
目录
欧拉函数
欧几里得
中国剩余定理
中的搜索
求组合数
的阶乘
的错排
全排列:
素数打表模板:
表达式求值
函数
任意进制互相转换(最大 进制互相转换)
对二进制的 个数的处理
大数求余(正负都可)
大数的加减乘除的处理(前者大于后者,且无负数)
堆栈
题解:
队列 !
"## !
题解:
$%
#&'(
题解:
) 自动机
全文检索
题解:
字典树:
题目:*+',
题解:(-..可解 (..超空间)
背包
题目
题解:
完全背包(定量求组合种类)
题目:
题解:
其他求最大值(整数划分):
其他求最大值(完全背包最大值):
多重背包: !
题目: !
题解:
皇后
迷宫问题
题目:
题解:
/
题目:速算 点
题解:
题目:0-1' !
题解: !
动态规划
2+3 ,
题解:
-' 最长公共子序列(可以输出最长公共序列并计数)!
' 最长上升子序列(导弹拦截系统)!
题目:-+0 !
题解: !
题目:'#-0(*4'3&(5'$(4 !
题解: !
区间重合(贪心) !!
题目:63! !!
题解: !
深度优先算法(47')8有效步数9 !
题目:*44:-1 !
题解: !
广度优先算法(7')
题目:
题目大意:
解读:
题解:
题目:畅通工程
题解:
$#'1
题目:)(;
题解: !
<1'(解决最短路)
题目:#-1(
题解:
/,4(解决最短路)
题目:2=4, '-+0
题解:
: ;/4(以判断负环为例)
题目:> &'(虫洞)
题解: !
最大流最小割:
/?
题解:
',(&#''0'
题解:
最大流
题目:(-&'
题解:
博弈论
博弈
题目:(%-&' )
题解:
题目:2=!
:'& 博弈
题目:2=
题解:
>,&@ 博弈
题目:2=
题解:
/-- 博弈
题目:
题解:
极大极小过程博弈
题目
题解
欧拉函数
A-#4B'4&C
A4D%)E
FF!#8%)E9G
H4I#J
#89KG
7KGB%)EG..
#89KG
7KGB%)EG..
7#89KK
7<KG<B%)EG<.K
#8<9K#8<9LM;G
N
J
I#G
G
?&O'-7PQ4PRS
+TPQ!4UPR#89G
#G
N
欧几里得 GCD
(-4 RLL求 与 的最大公约数
J
?& C
J
-KQ G
K G
K-G
N
#G
N
在 (& 库函数中有FF(-4函数供使用效果相同
中国剩余定理
Strange Way to Express Integers
Time Limit:1000MS
Memory
Limit:131072K
Total
Submissions:22293
Accepted:7465
Description
Elina is reading a book written by Rujia Liu, which introduces a strange way
to express non-negative integers. The way is described as following:
Choose"k"different positive integers"a
1
,"a
2
,"…,"a
k
. For some non-negative"m,
divide it by every"a
i
"(1 ≤"i"≤"k) to find the remainder"r
i
. If"a
1
,"a
2
, …,"a
k
"are
properly chosen, m can be determined, then the pairs (a
i
,"r
i
) can be used to
express"m.
“It is easy to calculate the pairs from"m, ” said Elina. “But how can I
find"m"from the pairs?”
Since Elina is new to programming, this problem is too difficult for her. Can
you help her?
Input
The input contains multiple test cases. Each test cases consists of some
lines.
Line 1: Contains the integer"k.
Lines 2 ~"k"+ 1: Each contains a pair of integers"a
i
,"r
i
"(1 ≤"i"≤"k).
Output
Output the non-negative integer"m"on a separate line for each test case. If
there are multiple possible values, output the smallest one. If there are no
possible values, output"-1.
Sample Input
2
8 7
11 9
Sample Output
31
A-#4B'4&C
A-#4B'(&C
A-#4B(& C
A-#4B' C
剩余63页未读,继续阅读
资源评论
王道之
- 粉丝: 34
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功