geometry Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 340    Accepted Submission(s): 256 Problem Description There is a point P at coordinate (x,y).A line goes through the point, and intersec…
tree Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 863    Accepted Submission(s): 409 Problem Description There is a tree(the tree is a connected graph which contains n points and n−1 edges),t…
B. Pasha Maximizes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pasha has a positive integer a without leading zeroes. Today he decided that the number is too small and he should make it…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=5610 如果杠铃总质量是奇数直接impossible 接着就考验耐心和仔细周全的考虑了.在WA了三次后终于发现问题了,想对自己说是不是撒 首先最好从大的那个开始考虑,我的方案就是两数交换一下,结果输出的时候没有考虑... 然后就是要求a+b最小,那么循环就要从大的开始向小的循环. 其实我也解释不清楚,更解释不清楚的是学长取名的Baby Nero,一直以为铭铭姐是女的的我,在看到真的铭神的照片的时候惊呆了…
题目:Click here 题意:给你n个点,有多少个正多边形(3,4,5,6). 分析:整点是不能构成正五边形和正三边形和正六边形的,所以只需暴力枚举四个点判断是否是正四边形即可. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #define power(x) ((x)*(x)) using names…
并查集 1002 tree 题意:中文题面 分析:(官方题解)把每条边权是1的边断开,发现每个点离他最近的点个数就是他所在的连通块大小. 开一个并查集,每次读到边权是0的边就合并.最后Ansi=size[findset(i)],sizeAns_i=size[findset(i)],sizeAns​i​​=size[findset(i)],size表示每个并查集根的size. 其实DFS也能过. #include <cstdio> #include <cstring> #includ…
题意:给你一个图,每条边权值0或1,问每个点周围最近的点有多少个? 思路:并查集找权值为0的点构成的连通块. #include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<algorithm> #define clc(a,b) memset(a,b,sizeof(a)) using namespace std; ],a[];//标记根节点 int…
D. Dreamoon and Binary time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Dreamoon saw a large integer x written on the ground and wants to print its binary form out. Dreamoon has accomplishe…
NN is an experienced internet user and that means he spends a lot of time on the social media. Once he found the following image on the Net, which asked him to compare the sizes of inner circles: It turned out that the circles are equal. NN was very…
#include<bits/stdc++.h>using namespace std;const int N=200005;int n,A[N];long long Mx,tot,S[N];vector<int>Adj[N];void DFS(int v,int p){    S[v]=A[v];    for(int &u:Adj[v])        if(u!=p)            DFS(u,v),S[v]+=S[u];    if(p)//0号结点是不存在的…