抱歉,您的浏览器无法访问本站

本页面需要浏览器支持(启用)JavaScript


了解详情 >

七つの海

ひと結び、人を結んで

这一轮比赛的题目明显比起之前要友好许多——至少在最后一刻都能让队友满载做题,甚至还能感觉到一丝时间不够用……这比起之前的比赛可以说是天大的进步了,不过这也都是因为题目友好;而且简单的能做的题目就要尽快做出来这一愿望在这次比赛砸的荡然无存(签到题 +5 我来给大家表演一个队友消失术

89K5SF2PF2J7JT8QD.gif

虽然题目数量变多了,但是这一次的题目应该会比之前的要好补;

因为接下来比赛还有好多,所以接下来的题目若无必要就都不放题目翻译了…… 毕竟像我这种萌新写翻译还是挺花时间的,补题才是要紧之事(

A - Clam and Fish

简单题,队友 A 的

B - Classical String Problem

C - Operation Love

平面几何,给手形,可能翻转放大缩小,判断是左手还是右手;因为点是根据时针方向给的(这点省了很多事,有一说一我并不知道不按照顺序给我要怎么办),只需要一个叉积判断顺逆时针就完事;观察图形,最长边只有一个,所以可以利用最长边定位;确定方向之后,最长边前后长度就可以用作左右手的判据

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
#include <iostream>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <cstring>
#include <cmath>

using namespace std;
using longs = long long;
using uint = unsigned;

inline int nextInt()
{
int x = 0, f = 1, ch = getchar();
while (!isdigit(ch)) if (ch == '-') f = -1, ch = getchar();
while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
return x * f;
}

namespace Geo
{
using number = long double;
const number eps = 1e-8;

int compareTo(number x) {return x < -eps ? -1 : x > eps;}
int compareTo(number a, number b) {return compareTo(a-b);}

struct point
{
number x, y;

point() = default;
point(number x, number y) : x(x), y(y) {}

point operator +(const point &rhs) const {return {x + rhs.x, y + rhs.y};}
point operator -(const point &rhs) const {return {x - rhs.x, y - rhs.y};}
number operator *(const point &rhs) const {return x * rhs.x + y * rhs.y;}
point operator *(const number rhs) const {return {rhs * x, rhs * y};}
point operator /(const number rhs) const {return {x / rhs, y / rhs};}
point &operator +=(const point& rhs) {x += rhs.x; y += rhs.y; return *this;}
point &operator -=(const point& rhs) {x -= rhs.x; y -= rhs.y; return *this;}
point &operator *=(const number rhs) {x *= rhs; y *= rhs; return *this;}
point &operator /=(const number rhs) {x /= rhs; y /= rhs; return *this;}
bool operator ==(const point &rhs) const {return x == rhs.x && y == rhs.y;}
bool operator !=(const point &rhs) const {return !(rhs == *this);}

number dot(const point &rhs) const {return x * rhs.x + y * rhs.y;}
number cross(const point &rhs) const {return rhs.y * x - rhs.x * y;}
auto length() const {return sqrt(dot(*this));}
auto distance(const point &b) const {return (*this - b).length();}
auto distance(const point &ls, const point &rs) const
{return fabs((ls - *this).cross(rs - *this)) / ls.distance(rs);}
point normal() const {return (x || y) ? *this / length() : point(0, 0);}
auto angle() const {return atan2(y, x);}
point rotate(number a) const
{number c = cos(a), s = sin(a); return {c * x - s * y, s * x + c * y};}
point perpendicular() const {return {-y, x};}
point symmetry() const {return {-x, -y};}
number square() const { return x * x + y * y; }
};

struct line
{
point s, t;

line() = default;
line(number a, number b, number x, number y) : s(a, b), t(x, y) {}
line(const point &s, const point &t) : s(s), t(t) {}
};

int onLeft(point p, line l)
{
number xx = (l.t - l.s).cross(p - l.s);
return compareTo(xx);
}
}

using point = Geo::point;
using number = Geo::number;
using Geo::compareTo;

point p[25];
number d[25];

int main()
{
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);

int t;
cin >> t;
while (t --)
{
for (int i = 0; i < 20; ++ i)
cin >> p[i].x >> p[i].y;
d[0] = p[0].distance(p[19]);
for (int i = 1; i < 20; ++ i)
d[i] = p[i].distance(p[i - 1]);
int xp = 0; number xx = 0;
for (int i = 0; i < 20; ++ i)
if (compareTo(d[i], xx) > 0) xx = d[i], xp = i;
auto hand = Geo::line(p[xp], p[(xp + 19) % 20]);
auto &ff = p[(xp + 18) % 20], &bb = p[(xp + 1) % 20];
if (Geo::onLeft(ff, hand) > 0) // counterclockwise
if (compareTo(d[(xp + 1) % 20], d[(xp + 19) % 20]) > 0)
cout << "left" << endl;
else cout << "right" << endl;
else // clockwise
if (compareTo(d[(xp + 1) % 20], d[(xp + 19) % 20]) > 0)
cout << "right" << endl;
else cout << "left" << endl;
}

return 0;
}

这题最开始我还把左右手弄反了,神秘

D - Points Construction Problem

E - Two Matchings

F - Fraction Construction Problem

G - Operating on a Graph

H - Sort the Strings Revision

I - Sorting the Array

J - Operating on the Tree

K - Eleven Game

L - Problem L is the Only Lovely Problem

真 · 签到题;

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
#include <iostream>
#include <cctype>
#include <cstring>

using namespace std;
using longs = long long;
using uint = unsigned;

const int N = 2e5 + 5;
char s[N];

int main()
{
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);

cin >> s;
for (int i = 0; i < 6; ++ i) s[i] = tolower(s[i]);
auto ss = string(s);
if (ss.length() >= 6 && ss.substr(0, 6) == "lovely") cout << "lovely" << endl;
else cout << "ugly" << endl;

return 0;
}

比赛场上写的代码属实不好看,可以动作更快一些的(

后记

赛后复盘,觉得能力范围应该在七题以上,部分简单题的实现速度可以更快;但是这些题目中有不少题目都是那个大一队友想出来的,这果然还是不太行;

评论