CF-1027-B. Curiosity Has No Limits】的更多相关文章

http://codeforces.com/contest/1072/problem/B B. Curiosity Has No Limits time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output When Masha came to math classes today, she saw two integer sequences…
CF-1027-B. Curiosity Has No Limits http://codeforces.com/contest/1072/problem/B 题意: 给定两组序列a,b,长度为n-1.求数列t使得 a[i] = t[i]|t[i+1] b[i] = t[i]&t[i+1] 其中( \(0\le a[i]\le3\) , \(0 \le b[i] \le 3\) ) 分析: 刚看到这个题,感觉是dp,然后觉得范围只有0~3,可以分情况讨论,奈何写不出来转移方程于是dfs.然而写d…
F. Session in BSU https://codeforces.com/contest/1027/problem/F 题意: n场考试,每场可以安排在第ai天或者第bi天,问n场考完最少需要多少天. 分析: 将所有的a与b连边,一条边相当于一场考试,一个点相当于一个考试时间,每条边需要找一个点. 那么在一个联通块中,边数>点数,无解(这些考试都只能在这个联通块内的点考). 如果边数=点数,那么相当于出现了环,每条边和一个点匹配,即n场考试,n个考试时间,所以这个联通块内的答案就是最大的…
题意 题目链接 给出两个序列\(a, b\),求出一个序列\(t\),满足 \[a_i = t_i | t_{i + 1}\] \[b_i = t_i \& t_{i + 1}\] 同时,\(0 \leqslant a_i, b_i, t_i \leqslant 3\) Sol 打比赛的时候想到了拆位,从此走上不归路... 显然,当最后一位确定了之后,其他的数也都跟着确定了,.. 所以暴力枚举每个位置上是哪个数就行.. /* */ #include<bits/stdc++.h> #de…
思路: 对于序列t,只要第一个数确定了,后续的数也随之确定了.枚举四种情况即可.实现: #include <iostream> #include <vector> using namespace std; ], b[]; int get(int t, int a, int b) { , cnt = ; while (t || a || b) { , y = a & , z = b & ; && y == && z == ) ans |…
http://codeforces.com/contest/1031 (如果感觉一道题对于自己是有难度的,不要后退,懂0%的时候敲一遍,边敲边想,懂30%的时候敲一遍,边敲边想,懂60%的时候敲一遍,边敲边想,(真实情况是你其实根本不用敲那么多遍……),然后,这道题你就差不多可以拿下了ψ(`∇´)ψ) (IO模板在最后的蛋里) A. Golden Plate n*m矩形,最外圈为第一圈,间隔着选k个圈,问总共占多少给格子 每圈贡献=2n‘+2m'-4,圈圈长宽以-4递减下去 public sta…
链接:http://codeforces.com/contest/1072/ A - Golden Plate - [计算题] #include<bits/stdc++.h> using namespace std; inline )*;} int w,h,k; int ans; int main() { cin>>w>>h>>k; ,h-=,k--) ans+=calc(w,h); cout<<ans<<endl; } B - Cu…
Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2) #include <bits/stdc++.h> using namespace std; int n,m,k; ; int main() { cin>>n>>m>>k; ;i<=k-;++i) { sum+=(n+(m-))*-(i)*; } cout<<sum<<endl;…
日常工作中,总会遇到一些格式化显示的需求,下面做一些简单的整理 JDK中java.text下提供了格式化常用的工具类,具体结构见下图 时间日期格式化 DateFormat 采用DateFormat.get%Instance()方法进行实例化,提供format()进行格式化,可以讲Date和String两种类型的日期时间进行互转 例如 DateFormat.getInstance().format(Calender.getInstance().getTime()); 这种方法可以获得当前时间的格式…
Everytime I restart MySQL I have this warning: [Warning] Buffered warning: Changed limits: max_connections: 214 (requested 800) So I have to change max_connections variable: set global max_connections = 800; But /etc/my.cf has max_connections set: [m…