- 博客(82)
- 问答 (8)
- 收藏
- 关注
转载 字符串 (包含T全部元素的最小窗口)
链接:https://www.nowcoder.com/acm/contest/161/A来源:牛客网 题目描述小N现在有一个字符串S。他把这这个字符串的所有子串都挑了出来。一个S的子串T是合法的,当且仅当T中包含了所有的小写字母。小N希望知道所有的合法的S的子串中,长度最短是多少。链接:https://www.nowcoder.com/acm/contest/161/A来源:牛...
2018-08-31 21:02:25 499
原创 Minimum Cut
Problem DescriptionGiven a simple unweighted graph G (an undirected graph containing no loops nor multiple edges) with n nodes and m edges. Let T be a spanning tree of G.We say that a cut in G resp...
2018-08-30 16:18:47 911
原创 Largest Point HDU - 5461 (思维题)
Given the sequence A with n integers t1,t2,⋯,tn. Given the integral coefficients a and b. The fact that select two elements ti and tj of A and i≠j to maximize the value of at2i+btj, becomes the larg...
2018-08-30 13:31:54 119
原创 Best Solver(根据公式推 通项) [类斐波那契]
Problem DescriptionThe so-called best problem solver can easily solve this problem, with his/her childhood sweetheart.It is known that y=(5+26√)1+2x.For a given integer x (0≤x<232) and a given ...
2018-08-30 11:09:30 244
原创 bookshelf
Problem DescriptionPatrick Star bought a bookshelf, he named it ZYG !!Patrick Star has N book .The ZYG has K layers (count from 1 to K) and there is no limit on the capacity of each layer !Now Pa...
2018-08-29 15:41:44 526
原创 G - Sort HDU - 5884(K叉哈夫曼树)
Recently, Bob has just learnt a naive sorting algorithm: merge sort. Now, Bob receives a task from Alice.Alice will give Bob N sorted sequences, and the i-th sequence includes ai elements. Bob need t...
2018-08-28 21:33:24 169
原创 Tree and Permutation(统计子树 节点个数 +思维)
Problem DescriptionThere are N vertices connected by N−1 edges, each edge has its own length.The set { 1,2,3,…,N } contains a total of N! unique permutations, let’s say the i-th permutation is Pi a...
2018-08-27 16:53:14 1363
原创 Problem G. Cyclic
Problem DescriptionCount the number of cyclic permutations of length n with no continuous subsequence [i, i + 1 mod n].Output the answer modulo 998244353.InputThe first line of the input contai...
2018-08-27 13:52:06 156
原创 Tribles UVA - 11021 (全概率公式)
#include<bits/stdc++.h>using namespace std;typedef long long LL;#define rep(i,a,b) for(int i=a;i<b;i++)const int maxn=1010;double p[maxn],f[maxn];int main(){ int T; scanf...
2018-08-27 11:13:50 138
原创 Rikka with Stone-Paper-Scissors(全概率公式)
Problem DescriptionDid you watch the movie "Animal World"? There is an interesting game in this movie.The rule is like traditional Stone-Paper-Scissors. At the beginning of the game, each of the tw...
2018-08-27 11:09:11 307
原创 Dream
Freshmen frequently make an error in computing the power of a sum of real numbers, which usually origins from an incorrect equation (m+n)p=mp+np, where m,n,p are real numbers. Let's call it ``Beginner...
2018-08-26 21:38:20 162
原创 Buy and Resell
The Power Cube is used as a stash of Exotic Power. There are n cities numbered 1,2,…,n where allowed to trade it. The trading price of the Power Cube in the i-th city is ai dollars per cube. Noswal is...
2018-08-26 13:45:33 233
原创 a-贝利福斯数 (各种线性筛)
链接:https://www.nowcoder.com/acm/contest/158/D来源:牛客网 题目描述将所有形如ax+1的数称为a-贝利福斯数,其中x是正整数。一个a-贝利福斯数是a-贝利福斯素数,当且仅当它不能被分解成两个a-贝利福斯数的积。现在给出a,n,问有多少个 ≤ n的a-贝利福斯数可以被分解成两个a-贝利福斯素数的积。输入描述:一行两个数a,n输...
2018-08-26 10:44:55 178
原创 最长区间
链接:https://www.nowcoder.com/acm/contest/158/B来源:牛客网 题目描述给你一个长度为 n 的序列 a ,求最长的连续的严格上升区间的长度。同时会进行 m 次修改,给定 x , y ,表示将 ax 修改为 y ,每次修改之后都要求输出答案。输入描述:第一行 2 个数 n,m,表示序列长度,修改次数; 接下来一行 n 个数表示 ;...
2018-08-25 21:47:47 580
原创 青蛙
链接:https://www.nowcoder.com/acm/contest/158/F来源:牛客网 题目描述一条河流上有 m+2 块石头,其中最左的石头坐标为 1 ,最右的为 n 。现在在起点 1 有无数只青蛙,每个青蛙一步可以跳 ≤ d 的任意长度,每个石头(除了起点,终点)只能被跳一次,问最多有多少只青蛙可以跳到终点 n 。有多组数据。输入描述:第一行 1 个数 ...
2018-08-25 19:15:28 279
原创 定向
链接:https://www.nowcoder.com/acm/contest/158/E来源:牛客网 题目描述给一张无向图,你需要将边定向,使得定向后的有向图强连通。输入描述:第一行两个数n,m,表示点数和边数。接下来m行,每个两个数x,y,表示x和y之间有条边。输出描述:如果不存在可行方案输出一行"impossible" ;否则,输出一个长度为m的01串,...
2018-08-25 10:37:58 157
原创 hdu6381 hex
Problem Description度度熊最喜欢六边形的网格了!!!上图由左至右依序是边长为 111, 222 以及 333 的六边形网格。另外,每个六边形网格最左侧的格子称之为这个六边形网格的锚点,上图中每个六边形网格的锚点都以蓝色着色。定义在六边形网格上的坐标系统:相对一个坐标为 (x,y)(x, y)(x,y) 的中心格子,其周围格子的坐标定义为下图中所示的值:...
2018-08-24 19:08:21 174
原创 Bee Breeding UVA - 808
思维难点: 对于这种坐标系,直接蒙逼。 但是,对于二维平面只要有两条不共线的向量,我们就可以表示出这个平面,也就是说 任何的点(或者说是以(0,0)为起点,以(x,y)为终点的向量) ,都能通过两个不共线的向量表示出来。通过建立平面直角坐标系,可以发现 在不同象限 向量长度的规律。!!!注意: 程序中的坐标起点在左上角,和正常的不一样,别忘了。#include<bits/std...
2018-08-23 22:19:55 192
原创 Problem J. CSGO HDU - 6435
You are playing CSGO.There are n Main Weapons and m Secondary Weapons in CSGO. You can only choose one Main Weapon and one Secondary Weapon. For each weapon, it has a composite score S.The higher th...
2018-08-23 20:09:27 196
原创 Requirements POJ - 2926
An undergraduate student, realizing that he needs to do research to improve his chances of being accepted to graduate school, decided that it is now time to do some independent research. Of course, he...
2018-08-23 16:57:04 89
原创 Problem A.Alkane
Multiple query, for each n, you need to getn i-1∑ ∑ [gcd(i + j, i - j) = 1]i=1 j=1InputOn the first line, there is a positive integer T, which describe the number of queries. Next there are T l...
2018-08-23 15:01:33 292
原创 Rikka with Ants
链接:https://www.nowcoder.com/acm/contest/148/H来源:牛客网 题目描述There are two small ants on Rikka's desk. If we consider Rikka's desk as a two-dimensional Cartesian coordinate system, both of them have ...
2018-08-22 21:52:58 336
原创 #108. 多项式乘法
题目描述这是一道模板题。输入两个多项式,输出这两个多项式的乘积。输入格式第一行两个整数 n n n 和 m m m,分别表示两个多项式的次数。第二行 n+1 n + 1 n+1 个整数,分别表示第一个多项式的 0 0 0 到 n n n 次项前的系数。第三行 m+1 m + 1 m+1 个整数,分别表示第二个多项式的 0 0 0 到 m m m 次项前的系数。输出格式...
2018-08-21 21:00:51 328
转载 P2257 YY的GCD
题目描述神犇YY虐完数论后给傻×kAc出了一题给定N, M,求1<=x<=N, 1<=y<=M且gcd(x, y)为质数的(x, y)有多少对kAc这种傻×必然不会了,于是向你来请教……多组输入输入输出格式输入格式: 第一行一个整数T 表述数据组数接下来T行,每行两个正整数,表示N, M 输出格式: T行,每行一个整数表示...
2018-08-21 16:50:05 155
原创 Strange Way to Express Integers POJ - 2891 (mod不互素)
Elina is reading a book written by Rujia Liu, which introduces a strange way to express non-negative integers. The way is described as following: Choose k different positive integers a1, a2, …, ak...
2018-08-21 13:03:31 101
原创 Rikka with Badminton
Problem DescriptionIn the last semester, Rikka joined the badminton club.There are n students in the badminton club, some of them have rackets, and some of them have balls. Formally, there are a st...
2018-08-20 21:02:28 236
原创 2301: [HAOI2011]Problem b (GCD加强版)
Description 对于给出的n个询问,每次求有多少个数对(x,y),满足a≤x≤b,c≤y≤d,且gcd(x,y) = k,gcd(x,y)函数为x和y的最大公约数。 Input第一行一个整数n,接下来n行每行五个整数,分别表示a、b、c、d、k Output共n行,每行一个整数表示满足要求的数对(x,y)的个数 Sample Input22 ...
2018-08-20 20:31:57 118
原创 暑假集训第五周
hdu 2018 Multi-University Training Contest 7Age of Moyu: 跑一遍最短路即可Sequence: 分段进行快速幂。很容易发现 p/n 在一段区间内是同一个值。 比如 p/3 (2) p/2 (1) p/1,所以采用从前往后递推的方式来做。当时,没有考虑p和n的关系,所以后面直接懵掉,应该是 只需要考虑到 min(n,...
2018-08-20 11:55:44 104
原创 洋灰三角
链接:https://www.nowcoder.com/acm/contest/136/J来源:牛客网 题目描述 洋灰是一种建筑材料,常用来筑桥搭建高层建筑,又称,水泥、混凝土。 WHZ有很多铸造成三角形的洋灰块,他想把这些洋灰三角按照一定的规律放到摆成一排的n个格子里,其中第i个格子放入的洋灰三角数量是前一个格子的k倍再多p个,特殊地,第一个格子里放1个。 W...
2018-08-19 19:49:49 246
原创 2D Geometry 110 in 1! UVA - 12304
!!!:注意Line的初始化#include<bits/stdc++.h>using namespace std;typedef long long ll;#define rep(i,a,b) for(int i=a;i<b;i++)#define per(i,a,b) for(int i=b-1;i>=a;i--)#define bug(x) pri...
2018-08-18 20:21:11 158
转载 GuGuFishtion
转载地址 线性求逆元原理:#include <cstdio>#include <bits/stdc++.h>#include <map>#include <cstring>#include <algorithm>using namespace std;#define mst(a,b) mems...
2018-08-18 14:00:51 205
原创 GCD
Problem DescriptionGiven 5 integers: a, b, c, d, k, you're to find x in a...b, y in c...d that GCD(x, y) = k. GCD(x, y) means the greatest common divisor of x and y. Since the number of choices may ...
2018-08-17 21:02:59 493
原创 B. Segment Occurrences
You are given two strings s and t, both consisting only of lowercase Latin letters.The substring s[l..r]is the string which is obtained by taking characters sl,sl+1,…,srwithout changing the or...
2018-08-17 15:11:31 471
原创 Typing practice
链接:https://www.nowcoder.com/acm/contest/147/F来源:牛客网 题目描述Niuniu is practicing typing.Given n words, Niuniu want to input one of these. He wants to input (at the end) as few characters (without b...
2018-08-17 14:11:58 2691
原创 Four-tuples
链接:https://www.nowcoder.com/acm/contest/123/F来源:牛客网 题目描述Given ,please count the number of four-tuples such thatand The answer should modulo109+7 before output.输入描述:The input consists o...
2018-08-15 21:49:09 283
原创 Character Encoding
Problem DescriptionIn computer science, a character is a letter, a digit, a punctuation mark or some other similar symbol. Since computers can only process numbers, number codes are used to repre...
2018-08-15 19:42:22 2641
原创 GCD - Extreme (II) UVA - 11426
#include<bits/stdc++.h>using namespace std;#define rep(i,a,b) for(int i=a;i<b;i++)#define per(i,a,b) for(int i=b-1;i>=a;i--)#define bug(x) printf("x:%d****\n",x)typedef long long ...
2018-08-14 22:29:50 281
原创 Always an integer UVA - 1069(多项式的差分数列+模拟)
#include<bits/stdc++.h>using namespace std;#define rep(i,a,b) for(int i=a;i<b;i++)#define per(i,a,b) for(int i=b-1;i>=a;i--)#define bug(x) printf("x:%d****\n",x)typedef long long ...
2018-08-14 21:55:27 163
原创 Series-Parallel Networks UVA - 10253
#include<bits/stdc++.h>using namespace std;#define rep(i,a,b) for(int i=a;i<b;i++)#define per(i,a,b) for(int i=b-1;i>=a;i--)typedef long long ll;const int maxn=40;ll dp[maxn][m...
2018-08-14 20:27:14 164
原创 Swordsman
Problem DescriptionLawson is a magic swordsman with k kinds of magic attributes v1,v2,v3,…,vk. Now Lawson is faced with n monsters and the i-th monster also has k kinds of defensive attributes ai,1,...
2018-08-14 15:55:38 371
空空如也
希望大神解答一下,这道题用bfs+优先队列为什么不对,只能用最短路径来写
2017-08-02
c语言中指针,希望大神解答
2017-04-08
C++ 中的析构函数,望大神解答
2017-03-28
找出语句中中最长的单词
2017-03-07
希望大神指点,十分感谢
2017-03-07
c语言编程中的问题,希望大神指点
2017-03-06
c语言计算三角形面积,存在不懂知识
2016-10-19
关于c语言学习中存在的问题
2016-10-19
TA创建的收藏夹 TA关注的收藏夹
TA关注的人