Description It’s an interesting experience to move from ICPC to work, end my college life and start a brand new journey in company. As is known to all, every stuff in a company has a title, everyone except the boss has a direct leader, and all the re…
Eddy's picture Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5178    Accepted Submission(s): 2566 Problem Description Eddy begins to like painting pictures recently ,he is sure of himself to b…
D. Dividing Kingdom II   Long time ago, there was a great kingdom and it was being ruled by The Great Arya and Pari The Great. These two had some problems about the numbers they like, so they decided to divide the great kingdom between themselves. Th…
C. Edgy Trees time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a tree (a connected undirected graph without cycles) of nn vertices. Each of the n−1n−1 edges of the tree is col…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3018 题目大意:有n个点,m条边,人们希望走完所有的路,且每条道路只能走一遍.至少要将人们分成几组. 解题思路:先用并查集求出所有的连通块,然后判断每个连通块内点的度数,如果有奇数点则需要的组数ans+=奇数点/2:反之,所需组数ans+=1.注意:如果遇到孤立点即度数为0的点则不用算进去,因为没有跟他相连的边. 代码: #include<iostream> #include<cstdio&…
#include<stdio.h> #include<math.h> int main() { int A,k,B,sum,c,d; while(scanf("%d%d%d",&A,&B,&k)&&(A||B)) { if(A%(c=pow(10.0,k))==B%(d=pow(10.0,k))) { sum=-; } else { sum=A+B; } printf("%d\n",sum); } }…
原创 利用到快速排序的思想,快速排序思想:https://www.cnblogs.com/chiweiming/p/9188984.html array代表存放数列的数组,K代表第K大的数,mid代表一趟快速排序后返回的基准记录下标: 一趟快速排序下来若基准记录存在的位置满足:array.length-mid==K,则说明array[mid]即是第 K大的数,若小于K,说明第K大的数在区间 [ left , mid-1 ],大于K说明在区间 [ mid+1,right ]: import jav…
Description Today is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the friends know each other, and all the friends do not want to stay…
Description Mr Wang wants some boys to help him with a project. Because the project is rather complex, the more boys come, the better it will be. Of course there are certain requirements. Mr Wang selected a room big enough to hold the boys. The boy w…
tree  Accepts: 143  Submissions: 807  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 65536/65536 K (Java/Others) 问题描述 有一个树(nn个点, n-1n−1条边的联通图),点标号从11~nn,树的边权是00或11.求离每个点最近的点个数(包括自己). 输入描述 第一行一个数字TT,表示TT组数据. 对于每组数据,第一行是一个nn,表示点个数,接下来n-1n−1,每行三个…