Testing Round #16 (Unrated)
比赛链接:https://codeforces.com/contest/1351
A - A+B (Trial Problem)
#include <bits/stdc++.h>
using namespace std; void solve() {
int a, b; cin >> a >> b;
cout << a + b << "\n";
} int main() {
int t; cin >> t;
while (t--) solve();
}
B - Square?
#include <bits/stdc++.h>
using namespace std; void solve() {
int a1, b1, a2, b2; cin >> a1 >> b1 >> a2 >> b2;
if (a1 > b1) swap(a1, b1);
if (a2 > b2) swap(a2, b2);
if (a1 + a2 == b1 and b1 == b2) cout << "YES" << "\n";
else cout << "NO" << "\n";
} int main() {
int t; cin >> t;
while (t--) solve();
}
C - Skier
#include <bits/stdc++.h>
using namespace std; void solve() {
string s; cin >> s;
map<pair<pair<int, int>, pair<int, int>>, bool> mp;
pair<int, int> pr{0, 0};
int ans = 0;
for (char c : s) {
pair<int, int> pr0 = pr;
if (c == 'N') pr.second++;
else if (c == 'S') pr.second--;
else if (c == 'W') pr.first--;
else pr.first++;
pair<pair<int, int>, pair<int, int>> p1 = make_pair(pr0, pr);
pair<pair<int, int>, pair<int, int>> p2 = make_pair(pr, pr0);
if (mp[p1] or mp[p2]) ++ans;
else mp[p1] = mp[p2] = true, ans += 5;
}
cout << ans << "\n";
} int main() {
int t; cin >> t;
while (t--) solve();
}
我这也算是在线 ak 过一场 cf 了吧 =。=
Testing Round #16 (Unrated)的更多相关文章
- Codeforces Testing Round #16 C.Skier
题意: 一个人在雪地上滑雪,每次可以向上下左右四个方向移动一个单位,如果这条路径没有被访问过,则需要5秒的时间,如果被访问过,则需要1秒(注意:判断的是两点之间的距离,不是单纯的点).给你他的行动轨迹 ...
- [Educational Codeforces Round 16]E. Generate a String
[Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file f ...
- [Educational Codeforces Round 16]D. Two Arithmetic Progressions
[Educational Codeforces Round 16]D. Two Arithmetic Progressions 试题描述 You are given two arithmetic pr ...
- [Educational Codeforces Round 16]C. Magic Odd Square
[Educational Codeforces Round 16]C. Magic Odd Square 试题描述 Find an n × n matrix with different number ...
- [Educational Codeforces Round 16]B. Optimal Point on a Line
[Educational Codeforces Round 16]B. Optimal Point on a Line 试题描述 You are given n points on a line wi ...
- [Educational Codeforces Round 16]A. King Moves
[Educational Codeforces Round 16]A. King Moves 试题描述 The only king stands on the standard chess board ...
- BestCoder Round #16
BestCoder Round #16 题目链接 这场挫掉了,3挂2,都是非常sb的错误 23333 QAQ A:每一个数字.左边个数乘上右边个数,就是能够组成的区间个数,然后乘的过程注意取模不然会爆 ...
- Codeforces Beta Round #16 (Div. 2 Only)
Codeforces Beta Round #16 (Div. 2 Only) http://codeforces.com/contest/16 A 水题 #include<bits/stdc+ ...
- Codeforces Beta Round #16 E. Fish (状压dp)(概率dp)
Codeforces Beta Round #16 (Div. 2 Only) E. Fish 题目链接:## 点击打开链接 题意: 有 \(n\) 条鱼,每两条鱼相遇都会有其中一只吃掉对方,现在给你 ...
随机推荐
- ICPC Central Russia Regional Contest (CRRC 19)题解
题目连接:https://codeforces.com/gym/102780 寒假第二次训练赛,(某菜依旧是4个小时后咕咕咕),战况还行,个人表现极差(高级演员) A:Green tea 暴力枚举即可 ...
- Python_列表(list)
list()类中的提供的操作 1.索引取值 li = [11,22,33,44,55] v1 = li[3] print(li[2]) #索引取出33 print(v1) #索引取出44 print( ...
- selenium自动化 | 通过获取cookies登录
>>>登录百度<<<#获取登录成功后的cookies def get_cookies(): driver.get(bd_url) driver.implicitly ...
- 【ASM】查看ASM磁盘组剩余容量和总容量
col total_size for a10; col free_size for a20; select name,total_mb/1024 || 'G' as total_size , free ...
- Leetcode53. 最大子序列和
问题 给定一个整数数组 nums ,找到一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和. 代码 贪心算法 核心思想就是检查之前 i-1 的元素和,如果小于零就舍弃--对应下面第六行 ...
- 单片机—Arduino UNO-R3—学习笔记001
连接方法 下载Arduino软件 安装完成打开如图所示 观察右下角的连接接口"Arduino Uno在COM(X)" 在工具-->端口-->选择之前查看的端口 即为连接 ...
- ctfhub技能树—信息泄露—PHPINFO
打开靶机 查看页面,是PHP info界面 只有这一个页面,查找一下有没有flag 拿到flag 浅谈ctf中phpinfo需要关注的点(转自先知社区) 1 https://xz.aliyun.com ...
- 从JAVA内存到垃圾回收,带你深入理解JVM
摘要:学过Java的程序员对JVM应该并不陌生,如果你没有听过,没关系今天我带你走进JVM的世界.程序员为什么要学习JVM呢,其实不懂JVM也可以照样写出优质的代码,但是不懂JVM有可能别被面试官虐得 ...
- jackson学习之二:jackson-core
欢迎访问我的GitHub https://github.com/zq2599/blog_demos 内容:所有原创文章分类汇总及配套源码,涉及Java.Docker.Kubernetes.DevOPS ...
- Python+Selenium+Unittest实现PO模式web自动化框架(5)
1.PageObjects目录下的模块 该目录下是存放各页面功能点. 比如:login_page.py模块下就是存放登录页面上的各个功能点的.(登录功能.获取登录失败的提示信息) # --^_^-- ...