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\) 条鱼,每两条鱼相遇都会有其中一只吃掉对方,现在给你 ...
随机推荐
- 用 Flutter 搭建标签+导航框架
前言 在 Flutter 这个分类的第一篇文章总结了下最新的 Mac 搭建 Flutter 开发环境和对声明式UI这个理解的东西,前面也有提过,准备像在 SwiftUI 分类中那样花一些功夫来写一个 ...
- LeetCode747 至少是其他数字两倍的最大数
在一个给定的数组nums中,总是存在一个最大元素 . 查找数组中的最大元素是否至少是数组中每个其他数字的两倍. 如果是,则返回最大元素的索引,否则返回-1. 示例 1: 输入: nums = [3, ...
- 剑指offer 面试题10.2:青蛙变态跳台阶
题目描述 一只青蛙一次可以跳上1级台阶,也可以跳上2级--它也可以跳上n级.求该青蛙跳上一个n级的台阶总共有多少种跳法. 编程思想 因为n级台阶,第一步有n种跳法:跳1级.跳2级.到跳n级跳1级,剩下 ...
- Tengine 四层代理:
Tengine 四层代理: 1 ) 安装tengine ( nginx1.9 以上版本 编译以后要支持stream 模块) 1.1 ) tengine(nginx) 一定要是nginx-1.9.X 以 ...
- Netty源码解析 -- FastThreadLocal与HashedWheelTimer
Netty源码分析系列文章已接近尾声,本文再来分析Netty中两个常见组件:FastThreadLoca与HashedWheelTimer. 源码分析基于Netty 4.1.52 FastThread ...
- 通过trace分析优化其如何选择执行计划
mysql5.6提供了对sql的跟踪trace,通过trace文件能够进一步了解为什么优化其选择执行计划a而不选b执行计划,帮助我们更好的理解优化其的行为. 使用方式:首先打开trace,设置格式为j ...
- Linux设置开机自动挂载镜像文件
1.将文件上传到服务器上(本例上传到/Data/software下) 2.挂载 mount -o loop /Data/software/rhel-server-7.6-x86_64-dvd.iso ...
- 多视图子空间聚类/表示学习(Multi-view Subspace Clustering/Representation Learning)
多视图子空间聚类/表示学习(Multi-view Subspace Clustering/Representation Learning) 作者:凯鲁嘎吉 - 博客园 http://www.cnblo ...
- USB2514集线器调试总结
一般的MCU不会留有太多的USB口,但在实际项目中又会遇到需要很多个USB口的情况,这时就会用到USB集线器来扩展USB口了.USB2514这个芯片是我在工作中用的比较多的,但是问题很多,从来没有调稳 ...
- 转 Fiddler1 简单使用
Fiddler1 简单使用 文章转自:https://www.cnblogs.com/zhengna/p/9008014.html 1.Fiddler下载地址:https://www.tele ...