Codeforces Round #676 (Div. 2) A - D个人题解(E题待补)
1421A. XORwice
题目链接:Click Here
cpp
// Author : RioTian
// Time : 20/10/18
#include <bits/stdc++.h>
#define ms(a, b) memset(a, b, sizeof a)
using namespace std;
typedef long long ll;
ll n, m, _;
void solve() {cin >> n >> m;cout << (n ^ m) << endl;
}
int main() {// freopen("in.txt", "r", stdin);ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);cin >> _;while (_--) solve();
}
1421B. Putting Bricks in the Wall
题目链接:Click Here
如果选择S的邻居为1,我们就可以F使为0的邻居,就没有办法从S到F,但这在最坏的情况下需要4个开关,这是不够的。 幸运的是,为了减少到2个开关,只需反过来考虑,使相邻S的正方形变为0,使相邻的正方形变为F 1。必须存在最多具有两个开关的两个正方形的解,并且您不会从S到F,因为被迫选择1(或0),并且无法通过与F相反的邻居。
cpp
// Author : RioTian
// Time : 20/10/18
#include <bits/stdc++.h>
#define ms(a, b) memset(a, b, sizeof a)
using namespace std;
typedef long long ll;
ll n, m, _;
char x[210][210];
void solve() {cin >> n;for (int i = 1; i <= n; i++) cin >> x[i] + 1;int a = x[1][2] - '0', b = x[2][1] - '0', c = x[n][n - 1] - '0',d = x[n - 1][n] - '0';if (a == b && c == d && a != c)cout << 0 << endl;else if (a != b && c != d)cout << 2 << endl<< 1 << " " << 2 << endl<< (a == c ? n - 1 : n) << " " << (a == c ? n : n - 1) << endl;else if (a != b)cout << 1 << endl<< (a == c ? 1 : 2) << ' ' << (a == c ? 2 : 1) << endl;else if (c != d)cout << 1 << endl<< (a == c ? n : n - 1) << ' ' << (a == c ? n - 1 : n) << endl;elsecout << 2 << endl << 1 << ' ' << 2 << endl << 2 << " " << 1 << endl;
}
int main() {// freopen("in.txt", "r", stdin);ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);cin >> _;while (_--) solve();
}
python
#python
import sys
input = sys.stdin.readline
I = lambda : list(map(int,input().split()))t,=I()
for _ in range(t):n,=I()l=[input().strip() for i in range(n)]an=[]le=[0,0,1,1,1];p=[1,1,0,0,0]rq=[l[0][1],l[1][0],l[1][1],l[2][0],l[0][2]]pos=[[1,2],[2,1],[2,2],[3,1],[1,3]]ct=cp=0;a1=[]for i in range(5):if le[i]!=int(rq[i]):ct+=1a1.append(pos[i])for i in range(5):if p[i]!=int(rq[i]):cp+=1an.append(pos[i])if ct<=cp:an=a1print(len(an))for i in an:print(*i)
1421C. Palindromifier
题目链接:Click Here
这道题写的挺懵的,一开始都没理解题意
被dalao提醒以后然后发现是构造题,根据题目说的两种方案:
对于任何字符串都可以先 $L ,i = 2 ,然后,然后R,i = 2 $ + R,i=7R,i=7。一定能构造需所需的字符串
cpp
// Author : RioTian
// Time : 20/10/18
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
int main() {// freopen("in.txt","r",stdin);ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);cin >> s;cout << "3\nL 2\nR 2\n";cout << "R " << 2 * s.size() - 1 << endl;
}
python
print('3\nL 2\nR 2\nR',len(input())*2-1)
1421D. Hexagons (补)
题目链接:Click Here
cpp
// Author : RioTian
// Time : 20/10/18
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int inf = 1e9 + 7;
ll x, y, c1, c2, c3, c4, c5, c6;
ll check(ll ad) {ll ans = 0;if (ad > 0)ans += ad * c1;elseans += -ad * c4;if (x - ad > 0)ans += (x - ad) * c6;elseans += (ad - x) * c3;if (y - ad > 0)ans += (y - ad) * c2;elseans += (ad - y) * c5;return ans;
}
void solve() {cin >> x >> y >> c1 >> c2 >> c3 >> c4 >> c5 >> c6;ll l = -inf, r = inf;while (l < r) {ll mid = l + r >> 1;if (check(mid) < check(mid + 1))r = mid;elsel = mid + 1;}cout << min({check(l), check(l + 1), check(l - 1)}) << '\n';
}
int main() {int t;cin >> t;while (t--) solve();
}
1421E. Swedish Heroes (补)
题目链接:Click Here
鞋子
美容
母婴
箱包
53货源网
特产
货源关键词大全
学院
女鞋
情侣装
内衣
男鞋
女鞋
童鞋
Codeforces Round #676 (Div. 2) A - D个人题解(E题待补)相关推荐
- Codeforces Round #698 (Div. 2)(A ~ F)6题全,超高质量题解)【每日亿题】2021/2/4
整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 [每日亿题]Codeforces Round #698 (Div. 2)(A ~ F)6题全,超 ...
- Codeforces Round #699 (Div. 2) (A ~ F)6题全,超高质量良心题解【每日亿题】2021/2/6
整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 Codeforces Round #699 (Div. 2) (A.B.C)[每日亿题]2021/2/ ...
- Codeforces Round #807 (Div. 2)A~E个人题解
Dashboard - Codeforces Round #807 (Div. 2) - Codeforces A. Mark the Photographer 题意: 有个人,每个人的身高设为,现在 ...
- Codeforces Round #706 (Div. 2)-A. Split it!-题解
目录 Codeforces Round #706 (Div. 2)-A. Split it! Problem Description Input Output Sample Input Sample ...
- Codeforces Round #742 (Div. 2) B、C 题解
Codeforces Round 742 B. MEXor Mixup 题意 有一个数组,输入两个数a,b,a代表这个数组之外的最小非负整数,b代表这个数组的异或值,问你该数组的最小长度. 思路 首先 ...
- Codeforces Round #676 (Div. 2) E待补
"楼下一个男人病得要死,那间隔壁的一家唱着留声机,对面是弄孩子.楼上有两人狂笑:还有打牌声.河中的船上有女人哭着她死去的母亲.人类的悲欢并不相通,我只觉得他们吵闹." A - XO ...
- Codeforces Round #370 (Div. 2) A. Memory and Crow 水题
A. Memory and Crow 题目连接: http://codeforces.com/contest/712/problem/A Description There are n integer ...
- Codeforces Round #311 (Div. 2) A. Ilya and Diplomas 水题
A. Ilya and Diplomas Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/557/ ...
- Codeforces Round #394 (Div. 2) A. Dasha and Stairs 水题
A. Dasha and Stairs 题目连接: http://codeforces.com/contest/761/problem/A Description On her way to prog ...
最新文章
- java中静态方法可以被继承_关于java:静态方法中的继承
- 双重惊喜——Windows Phone Developer Tools初体验
- 苹果发行10亿美元绿色债券 继续支持巴黎协定
- Awk使用案例总结(运维必会)
- oracle xmltype使用,oracle的xmltype基本使用有哪些呢?
- 计算机上差额如何计算公式,【】两个Excel表格之间怎么相加减 计算两个表格的差额???用什么公式??? 具体步骤怎么的...
- JAVA web 会话技术CookieSession
- python3 类实例化流程
- 再现神人!仅仅只花4天半就解开了史上最难密码,这下整个圈子都炸开了.........
- 2019职称计算机考试哪些地区取消,2019年职称计算机考试注意事项
- gif透明背景动画_ppt模板3D卡通GIF动画PPT素材,多种多样的日常动作
- 暴风影音2007全功能完美版和Symantec Norton的冲突
- jwt token注销_JWT 管理用户登录时,都需要把 token 存数据库里,判断用户登出时删除吗?...
- 机器人商用或工业版控制器(含ROS和SLAM等)2022 部分
- 详解SQL中Groupings Sets 语句的功能和底层实现逻辑
- 怎么才能制作一个比较好的网站
- 大家在人生低谷时有多惨,怎么熬过来的(五)
- 再谈 Go 语言在前端的应用前景
- 小青蛙跳台阶的另类思考
- 2017 php recaptcha,PHP形成谷歌reCAPTCHA