ZOJ 2421 Recaman's Sequence】的更多相关文章

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1421 题目大意: 定义a^m为 a^m = a^(m-1) - m  如果a^m 为正且没有出现过.否则a^m = a^(m-1) + m .给你k,让你求a^k 思路: 打表. k最大为50万,而a[500000]<63万,故我们开个数组记录是否出现过即可. #include<cstdio> const int MAXK=500000+2; const int MA…
                                                                                                      Recaman's Sequence Time Limit: 3000MS   Memory Limit: 60000K Total Submissions: 22363   Accepted: 9605 Description The Recaman's sequence is defined…
Recaman's Sequence Time Limit: 3000MS Memory Limit: 60000K Total Submissions: 22392 Accepted: 9614 Description The Recaman's sequence is defined by a0 = 0 ; for m > 0, am = am−1 − m if the rsulting am is positive and not already in the sequence, othe…
Recaman's Sequence Time Limit: 3000ms Memory Limit: 60000KB This problem will be judged on PKU. Original ID: 208164-bit integer IO format: %lld      Java class name: Main   The Recaman's sequence is defined by a0 = 0 ; for m > 0, am = am−1 − m if the…
Recaman's Sequence Time Limit: 3000MS   Memory Limit: 60000K Total Submissions: 22566   Accepted: 9697 Description The Recaman's sequence is defined by a0 = 0 ; for m > 0, am = am−1 − m if the rsulting am is positive and not already in the sequence,…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4915题意:a[k]-一个任意的数,这个数要等于a[1]~a[k]每个数减去任意一个数,经过多次这样的变换到达目标b序列,能到达就yes不能到达距no思路:既然a[k]前面数相减等于这个数,则所有减去的数之和sum一定数偶数.其中最大的减数的2倍一定要小于这个sum,如果不满足就不可能从a序列到b序列.Gao The Sequence Time Limit: 2 Seconds…
[链接] 我是链接,点我呀:) [题意] [题解] 按照两个区间的排列方式 我们可以分成以下几种情况 会发现这两个区间的作用 最多只能把两段连续不同的区间变为相同. 那么写个for处理出连续不相同的一段的个数cnt. 根据上面的排列方式. 算出每个cnt对应的答案即可. 别忘了有些情况可以乘2. [代码] #include <bits/stdc++.h> #define ll long long #define rep1(i,a,b) for (int i = a;i <= b;i++)…
Description The Recaman's sequence is defined by a0 = 0 ; for m > 0, am = am−1 − m if the rsulting am is positive and not already in the sequence, otherwise am = am−1 + m. The first few numbers in the Recaman's Sequence is 0, 1, 3, 6, 2, 7, 13, 20, 1…
A.ZOJ 3666 Alice and Bob 组合博弈,SG函数应用 #include<vector> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int maxn = 10000 + 100; int SG[maxn]; vector<int> g[maxn]; int mex(int u) { //minimal exc…
各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1019 Grandpa's Other Estate 1034 Simple Arithmetics 1036 Complete the sequence! 1043 Maya Calendar 1054 Game Prediction 1057 Mileage Bank 1067 Rails 10…