思维题
Noble_le
这个作者很懒,什么都没留下…
展开
-
懒惰的苏珊 UVa1620
链接:http://blog.csdn.net/S1766434333/article/details/53056780 代码:原创 2017-08-09 10:20:02 · 339 阅读 · 0 评论 -
Riverside Curio
题目链接:http://codeforces.com/problemset/problem/924/C/*看懂题目 只要满足两个条件就OK啦 1. s[i]>=s[i+1]-1 && s[i]>=a[i]+1;(逆序遍历) 2.s[i]>=s[i-1];(正序遍历) */ #include int main() { int n; int a[100005],s[100005];原创 2018-04-10 21:12:35 · 173 阅读 · 0 评论 -
二分Three-level Laser
题目链接:http://codeforces.com/problemset/problem/924/B /*题解报告:题意要求(a[k]-a[j])/(a[k]-a[i])的最大值, 易知当a[j]和a[i]挨着的时候 上式会取的最大值, 即转化为求(a[k]-a[j])/(a[k]-a[j-1])的最大值, 要保证(a[k]-a[j])/(a[k]-a[j-1])式取得最大值就要使分子取得最大原创 2018-04-11 16:23:06 · 186 阅读 · 0 评论 -
漂亮的树
链接:https://www.nowcoder.com/acm/contest/84/B来源:牛客网题目描述街上有n棵树,标号为1...n,第i棵树的高度为ai。定义这n棵树是漂亮的,当且仅当 1. 对于所有的i,ai=an-i+1; 2. 对于1 <= i < n / 2 (不是整除),ai + 1= ai + 1;比如说 “2 3 4 5 5 4 3 2”和“1 2 3...原创 2018-04-30 11:37:43 · 169 阅读 · 0 评论 -
Average distance&&dfs&&vector
题目链接:点击打开链接 Problem Description Given a tree, calculate the average distance between two vertices in the tree. For example, the average distance between two vertices in the following tree is (d01原创 2018-04-23 20:42:19 · 189 阅读 · 0 评论 -
Make a Square
题目链接 分析:直接二进制暴力就行,注意不能有前导0,没有其他正数只有一个0也不允许。 代码: #include<iostream> #include<cstdio> #include<string.h> #include<math.h> using namespace std; typedef long long ll; char a[...原创 2018-05-12 18:42:35 · 769 阅读 · 0 评论 -
Permutation Cycle
题目链接 #include<bits/stdc++.h> #include<math.h> using namespace std; const int maxn=2e5+5; typedef long long ll; int n; int a[maxn]; int main() { while(scanf("%d",&n)!=EOF) { ...原创 2018-05-13 11:59:30 · 465 阅读 · 1 评论