专题-搜索

Read More

ubuntu18.04双硬盘(ssd+机械)+双系统(win10+linux)

安装

最先一定要分清楚一件事情

你的系统启动方式是什么

Read More

ECF-70-2

Educational Codeforces Round 70 (Rated for Div. 2)

A.You Are Given Two Binary Strings

乘2^k次,其实就是把二进制左移了k位

Read More

CF-577-2

Codeforces Round #577 (Div. 2)

A.Important Exam

问学生分数总和最大为多少

Read More

CF-569-2

吹爆这一场,第一次打到这么前,虽然赛后打得

Read More

CF-576-2

Codeforces Round #576 (Div. 2)

A.City Day

啊,爆哭,还想着怎么能优化一下,感觉会超时

Read More

我是树-线段树

线段树

拖了好久了呀,终于是把线段树写了,这个实在太好用了,经常能用

原理就先不写了,听了好多遍了,都大概懂了,一写代码还是很容易理解

就先放上来吧,当作模板看一下

Read More

我不是树-树状数组

树状数组

我是一个无情的博客搬运工

Read More

ECF-69-2

Educational Codeforces Round 69 (Rated for Div. 2)

A.DIY Wooden Ladder

找最长的的俩个,然后看是能放的木板多,还是给的木板多

Read More

19JXCPC

2019CCPC-江西省赛(重现赛)- 感谢南昌大学

1001.Cotree

题目思路:

又是我换根大法的展现时间

Read More

CF-575-3

Codeforces Round #575 (Div. 3)

A.Three Piles of Candies

傻逼题,一人拿一堆,剩下一堆还能随便分,加起来除2

Read More

19XZCPC(女生赛) 补表

2019中国大学生程序设计竞赛-女生专场(重现赛)-感谢南京晓庄学院

1001.Ticket

顺序选择循环结构

Read More

CF-574-2

Codeforces Round #574 (Div. 2)

A.Drinks Choosing

就把可以凑对的凑在一起,不能的俩俩组合

Read More

CF-571-2

Codeforces Round #571 (Div. 2)

Vus the Cossack and a Contest

m,k都不小于n

Read More

15ICPC上海

B - Binary Tree

题目思路:

我们可以想到每个数字都一可以用二进制表示

Read More

ECF-68-2

Educational Codeforces Round 68 (Rated for Div. 2)

Remove a Progression

找到规律,隔一个删一个

Read More

CF-559-2(未完待续)

就学了一个lower把,先放在这里

还要学习读题23333

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//#include<bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <string>
#include <cstring>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#define LL long long
using namespace std;
const int MAX = 300010;
const int MAX_1 = 55;
const int INF = 0xfffffff;//268435455,2e8;
const double EPS = 0.0000001;
const int MOD = 10000007;
int T,N,M;


/*-------------------------------------------------------------------------------------------*/
struct Man
{
LL x;
LL sum;
int cnt;
int m;
}man[MAX];
int won[MAX];
/* ------------------------------------------------------------------------------------------*/

bool Cmp(Man a,Man b)
{
return a.x < b.x;
}

int main()
{
cin >> N >> M;
LL ma = 0;
int mi = INF;
int flagm = 0;
int flag = 0;
for(int i = 1;i <= N;i++)
{
cin >> man[i].x;
ma = max(man[i].x,ma);
if(man[i].x) flagm = 1;
}
for(int i = 1;i <= M;i++)
{
cin >> won[i];
mi = min(mi,won[i]);
if(!won[i]) flag = 1;
}
if((flag && flagm) || (ma > mi))
{
cout << -1 << endl;
return 0;
}
sort(man+1,man+N+1,Cmp);
sort(won+1,won+M+1,greater<int>());
bool f = false
for(int i = 1;i <= M;i++)
{
Man temp;
temp.x = won[i];
auto it = lower_bound(man+1,man+N,temp,Cmp);
for(;it != &man[0];it--)
{
if(it->cnt == M - 1 && !it->m && won[i] != it->x)
{
continue;
}
it->sum += won[i];
if(it->x == won[i]) it->m = 1;
it->cnt++;
break;
}
if(it == &man[0]) f = true;
}

if(f)
{
cout << "-1" <<endl;
return 0;
}
LL ans = 0;
for(int i = 1;i <= N;i++)
{
ans += man[i].sum;
ans += (M - man[i].cnt) * man[i].x;
}
cout << ans;
return 0;
}

Read More

CF-554-2(未完待续)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117

/*-------------------------------------------------------------------------------------------*/

int er[40];
int ans[40];

/* ------------------------------------------------------------------------------------------*/

void BinaryRecursion(int n,int step)
{
int a;
a=n%2;
n=n>>1;
if (n==0);
else BinaryRecursion(n,step+1);
er[step] = a;
}

void fan(int n,int m)
{
for(int i = m;i <= n;i++)
{
if(ans[i]) ans[i] = 0;
else ans[i] = 1;
}
}

int f(int n)
{
int i;
for(i = 0;i <= n;i++)
{
if(!ans[i])
{
return i;
}
}
return i;
}

void f1(int n)
{
for(int i = n;i >= 0;i--)
{
if(ans[i] == 1)
{
ans[i] = 0;
}
else
{
ans[i] = 1;
return;
}
}
}

int main()
{
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
/* --------------------------------------------------------------------------------------*/
cin >> N;
fill(er,er+40,-1);
BinaryRecursion(N,0);
int i = 0;
for(;i < 50;i++)
{
if(er[i] == -1) break;
}
i--;
for(int j = 0;j <= i;j++)
{
ans[j] = er[i - j];
//cout << ans[j];
}

int cnt = 0;
int cn = 0;
int a[50];

while(1)
{
int k = f(i);
if(k > i)
{
break;
}
else
{
a[cn++] = i - k + 1;
fan(i,k);
cnt++;
int k = f(i);
if(k > i) break;
f1(i);
cnt++;
}
// for(int j = 0;j <= i;j++)
// {
// cout <<ans[j] << " ";
// }
// cout <<endl;
}

if(cnt == 0) cout << 0 <<endl;
else
{
cout <<cnt <<endl;
for(int j = 0;j < cn;j++)
{
cout << a[j];
if(j!= cnt) cout << " ";
}
}
return 0;
}

Read More

CF-570.3

传送门

A:

就是他

1
2
3
4
5
while (N)
{
printf("%d ", N % 10);
N /= 10;
}

Read More

ECF-67.2

题目传送门

A:Stickers and Toys

三种情况,没有重叠,有重叠,都重叠

Read More

CF-572.2

传送门

A:Keanu Reeves

就是说要求串里的0,1个数不同

Read More

CF-573.2

A:1191-A

这个简单,完成仔细阅读即可做题,无非俩种情况

B:1191-B

这个也是分类就三种情况

Read More