Codeforces 994 C - Two Squares】的更多相关文章

C - Two Squares 思路: 点积叉积应用 代码: #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pi acos(-1.0) #define LL long long #define mp make_pair #define pb push_back #define ls rt<<1, l, m #define rs rt<<1|1…
D. Spongebob and Squares Spongebob is already tired trying to reason his weird actions and calculations, so he simply asked you to find all pairs of n and m, such that there are exactly x distinct squares in the table consisting of n rows and m colum…
discription Sereja painted n points on the plane, point number i (1 ≤ i ≤ n) has coordinates (i, 0). Then Sereja marked each point with a small or large English letter. Sereja don't like letter "x", so he didn't use it to mark points. Sereja thi…
输入n个点,问可以构成多少个正方形.n,xi,yi<=100,000. 刚看题的时候感觉好像以前见过╮(╯▽╰)╭最近越来越觉得以前见过的题偶尔就出现类似的,可是以前不努力啊,没做出来的没认真研究 首先想到的朴素是n^2的算法,10^10显然不行=.=抱着过预判的侥幸心理写了一发,打算过预判之后锁上看别人代码怎么做,结果TLE 13 第二天早上起来看题解,看不懂,看别人的代码才懂的.... 大概就是,避开最坏情况,枚举正方形左下角的点,然后如果当前x的点数量比sqrt(n)要小,就用当前x的上边…
#include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; +; long long a[maxn],n; long long Min; long long ans; long long b[maxn]; int main() { while(~scanf("%lld",&n)){ Min=; ;i<=…
题目链接 http://www.cnblogs.com/TheRoadToTheGold/p/8443668.html \(Description\) 给你一个擦去了部分左括号和全部右括号的括号序列,括号有25种,用除x之外的小写字母a~z表示.求有多少种合法的括号序列.答案对4294967296取模. 合法序列不能相交,如()[],([])是合法序列,而([)]是不合法的. \(Solution\) 很重要的一点是,如果当前可以放右括号,那么方案是唯一的(不能相交). 假设只有一种括号. 用\…
很容易得到n × m的方块数是 然后就是个求和的问题了,枚举两者中小的那个n ≤ m. 然后就是转化成a*m + c = x了.a,m≥0,x ≥ c.最坏是n^3 ≤ x,至于中间会不会爆,测下1e18就好. #include<bits/stdc++.h> using namespace std; typedef long long ull; vector<ull> ns; vector<ull> ms; //#define LOCAL int main() { #i…
B. Vika and Squares 题目连接: http://www.codeforces.com/contest/610/problem/B Description Vika has n jars with paints of distinct colors. All the jars are numbered from 1 to n and the i-th jar contains ai liters of paint of color i. Vika also has an infi…
D. Spongebob and Squares Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/599/problem/D Description Spongebob is already tired trying to reason his weird actions and calculations, so he simply asked you to find all pairs of…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Spongebob is already tired trying to reason his weird actions and calculations, so he simply asked you to find all pairs of n and m, such that t…