(全国多校重现赛一) J-Two strings】的更多相关文章

Giving two strings and you should judge if they are matched.  The first string contains lowercase letters and uppercase letters.  The second string contains lowercase letters, uppercase letters, and special symbols: "." and "*".  . can…
zk has n numbers a1,a2,...,ana1,a2,...,an. For each (i,j) satisfying 1≤i<j≤n, zk generates a new number (ai+aj)(ai+aj). These new numbers could make up a new sequence b1,b2,...,bn(n−1)/2b1,b2,...,bn(n−1)/2.  LsF wants to make some trouble. While zk i…
Senior Pan fails in his discrete math exam again. So he asks Master ZKC to give him graph theory problems everyday.  The task is simple : ZKC will give Pan a directed graph every time, and selects some nodes from that graph, you can calculate the min…
LsF is visiting a local amusement park with his friends, and a mirror room successfully attracts his attention. Inside the mirror room, there are n plane mirrors standing vertically on the ground. They are placed end-to-end and face-to-face so that i…
At Valentine's eve, Shylock and Lucar were enjoying their time as any other couples. Suddenly, LSH, Boss of FFF Group caught both of them, and locked them into two separate cells of the jail randomly. But as the saying goes: There is always a way out…
Mr. Cui is working off-campus and he misses his girl friend very much. After a whole night tossing and turning, he decides to get to his girl friend's city and of course, with well-chosen gifts. He knows neither too low the price could a gift be sinc…
You are given a complete binary tree with n nodes. The root node is numbered 1, and node x's father node is ⌊x/2⌋⌊x/2⌋. At the beginning, node x has a value of exactly x. We define the value of a path as the sum of all nodes it passes(including two e…
链接:https://ac.nowcoder.com/acm/contest/912/J 题意: 小r为了打校赛,他打算去打字社打印一份包含世界上所有算法的模板. 到了打字社,小r一看价格:总打印页数X0X0页以下(不含X0X0)x0x0元每页,X0∼X1X0∼X1页(不含X1X1)x1x1元每页,X1∼X2X1∼X2页(不含X2X2)x2x2元每页,X2∼X3X2∼X3页(不含X3X3)x3x3元每页,X3∼X4X3∼X4页(不含X4X4)x4x4元每页…… 小r转念一想,他可以多放一些白纸在…
J.Printout 题目:链接:https://ac.nowcoder.com/acm/contest/912/J 题目: 小r为了打校赛,他打算去打字社打印一份包含世界上所有算法的模板. 到了打字社,小r一看价格:总打印页数X0页以下(不含X0)x0元每页,X0∼X1页(不含X1)x1元每页,X1∼X2页(不含X2)x2元每页,X2∼X3页(不含X3)x3元每页,X3∼X4页(不含X4)x4元每页…… 小r转念一想,他可以多放一些白纸在模板里面,还能花更少的钱. 给出小r要打印的模板页数n以…
链接: http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1010&cid=872 题意: 鉴纯夏是一名成绩不太好的高中生.一天她在数学考试中碰到了一道求某条线段长度的问题.因为她并不会做这道题,所以她准确地作图后用尺子量出了这条线段的长度.不幸的是,答案在10进制下为一个无限小数,纯夏只量出了这个无限小数在10进制表示下的前若干位. 纯夏猜测问题的答案为一个有理数,所以答案为一个无限循环小数,如13=0.333⋯,3635=1…
题目链接:https://ac.nowcoder.com/acm/contest/992/J 题意:题意很清晰,就是求任意两点距离的和,结果对1e9+7取模. 思路:裸的树形DP题,一条边的贡献值=这条边的权值×左端连接的顶点数×右端连接的顶点数,所以我们dfs算出点y的子树大小siz[y],x为y的父结点,则x与y连线这条边的一端点的个数为siz[y],另一端点的个数为n-siz[y] ,贡献值即为dis[x,y]*siz[y]*(n-siz[y]),注意取模. AC代码: #include<…
链接:https://ac.nowcoder.com/acm/contest/992/J来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld 题目描述 红红和蓝蓝是随机降生在苹果树上的苹果仙灵,现在红线仙想估测他们的CP系数,并决定是否使他们成为一对CP. 给出n个结点n-1条边的树,节点编号为1到n,定义distance(i,j)为i与j的树上距离. CP系数是指所有红红和蓝蓝在不同位置i,…
2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 J Beautiful Numbers (数位DP) 链接:https://ac.nowcoder.com/acm/contest/163/J?&headNav=acm来源:牛客网 时间限制:C/C++ 8秒,其他语言16秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 NIBGNAUK is an odd boy and his taste is strange a…
今天做的沈阳站重现赛,自己还是太水,只做出两道签到题,另外两道看懂题意了,但是也没能做出来. 1. Thickest Burger Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 0    Accepted Submission(s): 0 Problem Description ACM ICPC is launching a thic…
传递 Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 42    Accepted Submission(s): 16 Problem Description 我们称一个有向图G是传递的,当且仅当对任意三个不同的顶点a,,若G中有 一条边从a到b且有一条边从b到c ,则G中同样有一条边从a到c.我们称图G是一个竞赛图,当且仅当它是一个有…
异或密码 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 19    Accepted Submission(s): 9 Problem Description 晨晨在纸上写了一个长度为N的非负整数序列{ai }.对于这个序列的一个连续子序列{al,al+1,…,ar }晨晨可以求出其中所有数异或的结果 alxoral+1xor...xo…
最大的位或 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 18    Accepted Submission(s): 17 Problem Description B君和G君聊天的时候想到了如下的问题.给定自然数l和r ,选取2个整数x,y满足l <= x <= y <= r ,使得x|y最大.其中|表示按位或,即C. C++.…
整理代码... Little Boxes Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 2304    Accepted Submission(s): 818 Problem Description Little boxes on the hillside.Little boxes made of ticky-tacky.Littl…
Little Zu Chongzhi's Triangles Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 2515    Accepted Submission(s): 1427 Problem Description Zu Chongzhi (429–500) was a prominent Chinese mathematic…
Song Jiang's rank list Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 2006    Accepted Submission(s): 1128 Problem Description <Shui Hu Zhuan>,also <Water Margin>was written by Shi Nai…
链接:https://www.nowcoder.com/acm/contest/163/F 来源:牛客网 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 F Color it 时间限制:C/C++ 3秒,其他语言6秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 There is a matrix A that has N rows and M columns. Each grid (i,j)(0 ≤ i < N,…
2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 F Color it (扫描线) 链接:https://ac.nowcoder.com/acm/contest/163/F来源:牛客网 时间限制:C/C++ 3秒,其他语言6秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 There is a matrix A that has N rows and M columns. Each grid (i,j)(0 ≤ i…
HDU6578 2019HDU多校训练赛第一场 1001 (dp) 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6578 题意: 你有n个空需要去填,有m个限制,每次限制要求在区间[l,r]内不同的点的个数是为x个,问你填完这n个空的并且满足限制的方案数 题解: 定义\(dp[i][j][k][t]\)表示在区间填完前t个位置后,{0,1,2,3}这四个数字最后一次出现的位置为i,j,k,t的方案数 滚动数组优化掉第一维后,我们转移如下 dp[p]…
HDU6579 2019HDU多校训练赛第一场1002 (线性基) 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6579 题意: 两种操作 1.在序列末尾添加一个数 2.查询区间异或最大值 强制在线 题解: 暴力的做法可以用数据结构维护区间线性基,但肯定过不了. 贪心地维护序列的前缀线性基 (上三角形态),对于每个线性基,将出现位置靠右的数 字尽可能地放在高位,也就是说在插入新数字的时候,要同时记录对应位置上数字的出现位 置,并且在找到可以插入的位…
1. 2016 CCPC 东北地区重现赛 2.总结:弱渣,只做出01.03.05水题 08   HDU5929 Basic Data Structure    模拟,双端队列 1.题意:模拟一个栈的操作,并在每次询问时,计算栈项到栈底元素nand位运算的值. 2.总结:思路就是看距离栈底最近的0的后面1的个数的奇偶.试了好多种办法,最后还是双端队列简便.总之,贼恶心的题.. #include<iostream> #include<cstring> #include<cmath…
1.2016中国大学生程序设计竞赛(长春)-重现赛 2.总结:会做的太少,应变能力也不行,或者说猜题目的能力不行 02  水 04  HDU 5914  Triangle 1.题意:1~n,n个数,问至少取出多少个数使剩下的数不构成三角形. 2.总结:比赛的时候想不出,直接数,反正n<=20..还是思维不灵活啊 3.思路:只要剩下的数都是fibnacci数列就可以. #include<iostream> #include<cstring> #include<cmath&…
周六周末组队训练赛. Dogs' Candies Time Limit: 30000/30000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 3920    Accepted Submission(s): 941 Problem Description Far far away, there live a lot of dogs in the forest. Unlike…
Rabbits Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1193    Accepted Submission(s): 628 Problem Description Here N (N ≥ 3) rabbits are playing by the river. They are playing on a number li…
F - Almost Sorted Array Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 5532 Description We are all familiar with sorting algorithms: quick sort, merge sort, heap sort, insertion sort, selectio…
2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 H - A Simple Problem with Integers (线段树,循环节) 链接:https://ac.nowcoder.com/acm/contest/163/H 来源:牛客网 链接:https://ac.nowcoder.com/acm/contest/163/H来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %ll…