- 博客(22)
- 收藏
- 关注
原创 [可能不算题解的题解]timus1053. Pinocchio
求给的数的gcd就行#include<bits/stdc++.h>using namespace std;vector<int> l(1010);int gcd(int a, int b){ if (a % b == 0) return b; else return gcd(b, a % b);}int main(){ ios::sync_with_stdio(0); cin.tie(0);...
2022-01-31 00:03:12
611
原创 acwing 154滑动窗口
#include<bits/stdc++.h>using namespace std;int n, k;deque<int> fax, fin;vector<int> num(1000010);int main(){ ios::sync_with_stdio(0); cin.tie(0); freopen(".in", "r", stdin); cin >> n >> k; fo...
2022-01-30 12:01:51
646
原创 acwing840模拟散列表
‘’‘#include<bits/stdc++.h>using namespace std;map<int,bool> m;int main(){ ios::sync_with_stdio(0); cin.tie(0); int t,x; char op; cin >> t; while (t--) { cin >> op >> x; if ...
2022-01-29 12:26:57
1331
原创 [可能不算题解的题解]timus1047.Simple Calculations
使用两次累加法求出a1的表达式#include<bits/stdc++.h>using namespace std;double n;double a, A;vector<double> c(3050);vector<double> t(3050);double T;int main(){ ios::sync_with_stdio(0); cin.tie(0); cin >> n; cin >&...
2022-01-27 17:04:08
801
原创 acwing827双链表
#include<bits/stdc++.h>using namespace std;int tt;const int N = 100010;int idx;vector<int > e(N), l(N), r(N);void iint(){ idx = 2; r[0] = 1; l[1] = 0;}void add(int k, int x){ e[idx] = x; r[idx] = r[k]; l[id...
2022-01-27 00:25:15
856
原创 acwing 826.单链表
#include<bits/stdc++.h>using namespace std;const int N = 100010;int tt;int head, idx=1;vector<int> e(N), ne(N, -1);void iint(){ head = -1; return;}void add_head(int x)//向链表头插入一个数{ ne[idx] = head; head = idx; ...
2022-01-25 14:04:38
302
原创 [可能不算题解的题解]timus1036.Lucky Tickets
因为前n位数字的组合方案数与后n位数字的组合方案数相同所以只用求出前n位数字的组合方案数再平方即可可以把问题看成共n个背包 有0 1 2 3 4 5 6 7 8 9共10种物品 需要拿够s/2的价值求有多少种拿法由于答案会有很多 所以需要用高精度#include<bits/stdc++.h>using namespace std;#define maxn 9999#define maxsize 1010#define dlen 4class bignum {priva
2022-01-24 23:35:21
106
原创 [可能不算题解的题解]timus1032. Find a Multiple
将这组数列进行前缀和处理,并将每个前缀和对n取模若取模结果为0则正好从 第一个数到这个数 可以是一个答案若无0的结果则可以知道 可以得到 n个 值为1到n-1之间 的结果根据鸽巢原理可知这n个结果之中必有 两个 以上相同若第i个与第j个结果相同则一个答案可以为 从第i个数字加到第j个数字#include<bits/stdc++.h>using namespace std;vector<int> num(10010);vector<int> .
2022-01-23 14:38:11
300
原创 [可能不算题解的题解]timus1024. Permutations
给一个固定的变化规则问这一个数列要经过几次变化之后能是升序可以发现每一位数字的变化有周期性 每一位的周期不同需要求出第i位数字从初始值变化到i的周期求出所有周期的最小公倍数即可#include<bits/stdc++.h>using namespace std;int n;vector<int> num;vector<int> cop;vector<int> turn;vector<long long> l;long
2022-01-22 15:02:09
231
原创 [可能不算是题解的题解]timus 1081.Binary Lexicographic Sequence
找规律可以发现 长度为n的序列的所有有效元素个数=长度为n-1的序列+长度为n-2序列有效元素之和并且 长度为n的序列中的前(n-1)个元素为 长度为n-1的序列 的每个元素之前加“0”剩余(n-2)个元素为 长度为n-2的序列 的每个元素之前加“10”#include<bits/stdc++.h>using namespace std;int n, k;int len[100];string search(int n, int k){ if (n == ..
2022-01-21 16:18:04
316
原创 timus1031. Railway Tickets
1031. Railway Tickets @ Timus Online Judge#include<bits/stdc++.h>using namespace std;#define endl '\n'vector<unsigned long long> l(4), c(4), sta;int n,s,e;vector<unsigned long long> f(10010, INT_MAX);int main(){ ios::...
2022-01-21 15:57:37
339
原创 洛谷1604B进制星球
#include<bits/stdc++.h>using namespace std;#define LL long long#define endl '\n'int B;vector<int> a, b;string s;void plu(vector<int> a, vector<int> b){ vector<int> c; int t = 0; for (int i = 0; i <=...
2022-01-20 13:44:07
244
原创 1008. Image Encoding
1008. Image Encoding @ Timus Online Judge#include<bits/stdc++.h>using namespace std;#define endl '\n'#define pii pair<int,int>string s;bool pd(string s){ for (int i = 0; i < s.size(); i++) if (s[i] == ' ' &&...
2022-01-19 15:08:12
118
原创 timus 1032. Find a Multiple
1032. Find a Multiple @ Timus Online Judge#include<bits/stdc++.h>using namespace std;vector<int> num(10010);vector<int> A(10010);vector<int> bj(10010);int main(){ ios::sync_with_stdio(0); cin.tie(0); int ...
2022-01-18 19:10:53
231
原创 timus 1053. Pinocchio
1053. Pinocchio @ Timus Online Judge#include<bits/stdc++.h>using namespace std;vector<int> l(1010);int gcd(int a, int b){ if (a % b == 0) return b; else return gcd(b, a % b);}int main(){ ios::sync_with...
2022-01-18 17:29:47
231
原创 timus 1087. The Time to Take Stones
1087. The Time to Take Stones @ Timus Online Judge#include<bits/stdc++.h>using namespace std;int n, m;vector<int> k(50);vector<int> f(10010, -1);int MIN = 1000000000;int sg(int x){ if (f[x] != -1) return f[x];...
2022-01-18 16:49:34
231
原创 timus 1047
1047. 简单计算@ Timus在线裁判#include<bits/stdc++.h>using namespace std;double n;double a, A;vector<double> c(3050);vector<double> t(3050);double T;int main(){ ios::sync_with_stdio(0); cin.tie(0); cin >> n; ...
2022-01-18 14:13:42
210
原创 timus 1036
1036. Lucky Tickets @ Timus Online Judge#include<bits/stdc++.h>using namespace std;#define maxn 9999#define maxsize 1010#define dlen 4class bignum {private: int a[500]; int len;public: bignum() { len = 1; memset(a, 0, sizeof a)...
2022-01-18 14:12:52
107
原创 timus 1081
#include<bits/stdc++.h>using namespace std;int n, k;int len[100];string search(int n, int k){ if (n == 1) { if (k == 1) return "0"; else return "1"; } if (n == 2) { if (k ==...
2022-01-18 14:12:10
294
原创 timus 1024
``int n;return b;int main()cin.tie(0);cin >> n;i > k;turn = num;i
2022-01-18 14:11:28
126
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人