<题目链接> 题目大意: 给出一个矩形,该矩形的四个顶点分别为:(0,d),(d,0),(n,n−d) and (n−d,n).然后给出一些点的坐标,分别判断这些点是否在该矩形内. 解题分析:开始还以为要用计算几何判断点是否在多边形内的板子,结果发现,给出的矩形四条边方程完全可以很容易的推出来,然后再将该点带入这四个方程,判断是否符合条件即可. #include <cstdio> int main(){ int n,d,m; scanf("%d%d%d",&am…
题目链接: C. Vasya and String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output High school student Vasya got a string of length n as a birthday present. This string consists of letters 'a' and '…
E - Vasya and Binary String 思路:区间dp + 记忆化搜索 转移方程看上一篇博客. 代码: #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize(4) #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define y1 y11 #define pi acos(-1.0)…
E - Vasya and a Tree 思路: dfs动态维护关于深度树状数组 返回时将当前节点的所有操作删除就能保证每次访问这个节点时只进行过根节点到当前节点这条路径上的操作 代码: #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize(4) #include<bits/stdc++.h> using namespace std; #define fi first #define se second #de…
E. Vasya and Good Sequences time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vasya has a sequence $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$. Vasya may pefrom the fol…
A. Vasya and Book time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vasya is reading a e-book. The file of the book consists of nn pages, numbered from 11 to nn. The screen is currently disp…
Discription Vasya is studying number theory. He has denoted a function f(a, b) such that: f(a, 0) = 0; f(a, b) = 1 + f(a, b - gcd(a, b)), where gcd(a, b) is the greatest common divisor of a and b. Vasya has two numbers x and y, and he wants to calcul…