链接: https://codeforces.com/contest/1272/problem/E 题意: You are given an array a consisting of n integers. In one move, you can jump from the position i to the position i−ai (if 1≤i−ai) or to the position i+ai (if i+ai≤n). For each position i from 1 to…
题目链接:http://codeforces.com/contest/1272/problem/E 题意:给定n,给定n个数a[i],对每个数输出d[i]. 对于每个i,可以移动到i+a[i]和i-a[i](如果i+a[i]<=n,i-a[i]>=1) d[i]是指从i移动到任意一个j的步数,需满足条件a[i]和a[j]的奇偶性不同 不论奇偶,相连的边先放进vector邻接表中 如果i和i+a[i]奇偶性不同,那么ans[i]为1,把i放到queue队列里 同理,如果i和i-a[i]奇偶性不同…
地址:http://codeforces.com/contest/1272 A. Three Friends 仔细读题能够发现|a-b| + |a-c| + |b-c| = |R-L|*2 (其中L = min{a, b, c}, R = max{a, b, c}) 那么本题的移动条件就只考虑两个端点L, R即可,答案即为 |(L+1)-(R-1)| 即L向右移动1,R向左移动1,在此之前判断一下原L,R之间的距离是否<=2,<=2输出0 #include <bits/stdc++.h&…
Three Friends Snow Walking Robot Yet Another Broken Keyboard Remove One Element Nearest Opposite Parity Two Bracket Sequences Three Friends \[ Time Limit: 1 s\quad Memory Limit: 256 MB \] 根据题意,把最大的减一,最小的加一,然后答案就是两倍他们的差值 view #include <map> #include…
B. Nearest Fraction Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/281/problem/B Description You are given three positive integers x, y, n. Your task is to find the nearest fraction to fraction  whose denominator is no mor…
比赛传送门 Div3真的是暴力杯,比div2还暴力吧(这不是明摆的嘛),所以对我这种一根筋的挺麻烦的,比如A题就自己没转过头来浪费了很久,后来才醒悟过来了.然后这次竟然还上分了...... A题:爆搜 B题:字符串,简单贪心 C题:字符串,简单数学 D题:DP A. Three Friends time limit per test 1 second memory limit per test 256 megabytes input standard input output standard…
链接: https://codeforces.com/contest/1272/problem/D 题意: You are given an array a consisting of n integers. You can remove at most one element from this array. Thus, the final length of the array is n−1 or n. Your task is to calculate the maximum possib…
链接: https://codeforces.com/contest/1272/problem/C 题意: Recently, Norge found a string s=s1s2-sn consisting of n lowercase Latin letters. As an exercise to improve his typing speed, he decided to type all substrings of the string s. Yes, all n(n+1)2 of…
链接: https://codeforces.com/contest/1272/problem/B 题意: Recently you have bought a snow walking robot and brought it home. Suppose your home is a cell (0,0) on an infinite grid. You also have the sequence of instructions of this robot. It is written as…