09 2018 档案
摘要:题目描述 如题,给定一棵有根多叉树,请求出指定两个点直接最近的公共祖先。 输入输出格式 输入格式: 第一行包含三个正整数N、M、S,分别表示树的结点个数、询问的个数和树根结点的序号。 接下来N-1行每行包含两个正整数x、y,表示x结点和y结点之间有一条直接连接的边(数据保证可以构成树)。 接下来M行
阅读全文
摘要:题目链接:https://nanti.jisuanke.com/t/31452 思路:首先,十以内的质数:2、3、5、7。然后一百以内的,2只且只能和3搭配即23,5同理,所以只剩下了3、7。但每个质数不能出现两次(当然1有些时候可以出现两次,但1不是质数呀)否则子序列就是合数了。 在两位数的基础上
阅读全文
摘要:题目链接:https://www.jisuanke.com/contest/1556/105551 代码如下: 1 #include <iostream> 2 #include <bits/stdc++.h> 3 using namespace std; 4 const int maxn = 1e5
阅读全文
摘要:题目描述 Tira would like to join a multiplayer game with n other players. Each player has a character with some features. There are a total of k features,
阅读全文
摘要:题目描述 Ahlaam is a computer science student, doing her master thesis on a bioinformatics project about MicroRNAs, special molecule types found in cells.
阅读全文
摘要:题目描述 Think of repetitively folding a very long and thin ribbon. First, the ribbon is spread out from left to right, then it is creased at its center,
阅读全文
摘要:题目描述 Given a registry of all houses in your state or province, you would like to know the minimum size of an axis-aligned square zone such that every
阅读全文
摘要:题目描述 The programming contest named Concours de Programmation Comtemporaine Interuniversitaire (CPCI) has a judging system similar to that of ICPC; con
阅读全文
摘要:将N!表示成 N! = p1^t1*p2^t2*…pi^ti…*pk^tk(其中p1,p2……pk是素数,1<N<= 10^6) 显然很容易通过素数筛选求出pi,因为1<pi<=N,关键是如何快速地求出ti。 我们先来看一下对于2这个素因子,把N!分成两部分,即奇偶两部分 假设N是偶数 N! =1*
阅读全文