Neko's loop HDU-6444(网络赛1007)】的更多相关文章

题意就是给出n个数,在n个数上每次跳k个数,最多可以跳m次,你可以选择跳任意次,也可以都不跳,问你为了达到目标了快乐值至少在开始的需要多少快乐值. 题目可以转换成找出循环节,然后再循环节上疯狂试探我可以得到的最大快乐值,然后减一下. 刚开始想着找循环节,只找了一个,用栈存,然后发现可能会有多个循环节,需要考虑多个循环节的最大值,就转成vector存了. 对于每一个循环节,先找一次长度为m的序列,但是m可能比我的循环节来的大,所以我考虑循环起来.让 y 表示的我循环起来的圈数,y = m / le…
题意:有编号为0~n-1的n个游戏,每个活动都有一个价值(可为负),给你m,s和k,你可以从任意一个编号开始玩,但是下一个游戏必须是编号为(i + k)%n的游戏,你最多能玩m次游戏,问你如果最后你手里要有s的价值,那么你至少一开始要有多少价值. 思路:由裴蜀定理可以知道,如果有n个值首尾相连,间隔为k地走,那么最后会有一个循环节,这样的循环节一共有gcd(n, k)个,每个循环节长度n / gcd(n, k)个.所以我们只要找出所有循环节,并且把每个循环节的最大价值算出来就行了.对于每个循环节…
题目链接 题意 : 给出一个 n 个元素的环.可以任意选择起点.选完起点后.可以行走 m 步.每次前进 k 个单位.所走到的点将产生正或负贡献.问你一开始得准备多少才能使得初始资金加上在环上获取最大利益不少于给定的 s 分析 : 对于一个环.固定步数下是有循环节的 不同循环节内的节点各不相同 根据裴蜀定理可得每个循环节的长度为 n / gcd(n, k) 所以共有 gcd(n, k) 个循环节 然后我们暴力扒出每一个循环节 循环节里面的元素放到一个新数组中.使其相邻 然后通过收尾相连接的方法模拟…
#include<stdio.h> #include<iostream> #include<algorithm> #include<math.h> #include<string.h> #include<string> #include<map> #include<set> #include<vector> #include<queue> #define M(a,b) memset(a,…
题意:给了一个数列,有多个询问,每个询问求某个区间内的最大值 数列长度 1000,询问个数 1000,静态,并不需要RMQ这些,直接暴力 n2 查找每个询问区间取最大值就行了. #include<stdio.h> #include<string.h> #include<algorithm> #include<math.h> using namespace std; typedef long long ll; ; int max(int a,int b){re…
思路:维护一个递增队列,如果当天的w比队首大,那么我们给收益增加 w - q.top(),这里的意思可以理解为w对总收益的贡献而不是真正获利的具体数额,这样我们就能求出最大收益.注意一下,如果w对收益有贡献,你会发现w入队了两次,这是因为这里的w可能会有两种可能: 1.当做中间价/最终卖出价 2.买入价 所以我们入队两个w,如果w是买入价,那么其中一个w作为中间价势必弹出,另一个w作为买入价:如果w是最终卖出价,那么两个w会一直待在队列里. 计算总数很简单,用map[i]表示以i为中间价还存在多…
注意题目中的这句话he put the strawberries on the cake randomly one by one,第一次选择草莓其实有N个可能,以某一个草莓为开头,然后顺序的随机摆放,所以最后的概率为n/m^(n-1),最后通过大数模板搞定该题的化简. C++代码 #include<iostream> #include<cstring> #include<cstdio> #include<iomanip> #include<algori…
A - Buy and Resell HDU - 6438 The Power Cube is used as a stash of Exotic Power. There are nn cities numbered 1,2,…,n1,2,…,n where allowed to trade it. The trading price of the Power Cube in the ii-th city is aiai dollars per cube. Noswal is a foxy b…
F(x) Time Limit: 1000/500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 382    Accepted Submission(s): 137 Problem Description For a decimal number x with n digits (AnAn-1An-2 ... A2A1), we define its weight as F(x…
Neko has a loop of size nn. The loop has a happy value aiai on the i−th(0≤i≤n−1)i−th(0≤i≤n−1) grid. Neko likes to jump on the loop.She can start at anywhere. If she stands at i−thi−thgrid, she will get aiai happy value, and she can spend one unit ene…
Neko's loop Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 356    Accepted Submission(s): 56 Problem Description Neko has a loop of size n.The loop has a happy value ai on the i−th(0≤i≤n−1) gri…
Neko's loop Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1386 Accepted Submission(s): 316 Problem Description Neko has a loop of size n. The loop has a happy value ai on the i−th(0≤i≤n−1) grid.…
HDU 4041 Eliminate Witches! (模拟题 ACM ICPC 2011 亚洲北京赛区网络赛题目) Eliminate Witches! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 863    Accepted Submission(s): 342 Problem Description Kaname Mado…
HDU 4046 Panda (ACM ICPC 2011北京赛区网络赛) Panda Time Limit: 10000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1816    Accepted Submission(s): 632 Problem Description When I wrote down this letter, you may have…
为迎接9月14号hdu命题的长春网络赛 ACM弱校的弱菜,苦逼的在机房(感谢有你)呻吟几声: 1.对于本次网络赛,本校一共6名正式队员,训练靠的是完全的自主学习意识 2.对于网络赛的群殴模式,想竞争现场赛名额,只有泪奔%>_<% 3.至于带队教练的请师兄帮帮忙,如果可以的活,他们能在训练过程中指导,岂不更好,个人对此表示不乐观 虽然形式很不乐观,但我们还是努力着,尽人事,然后…… 至于最终结果拭目以待吧 o(╯□╰)o 杭电上的题目 4267 A Simple Problem with Int…
# ccpc 网络赛 hdu 6155(矩阵乘法 + 线段树) 题意: 给出 01 串,要么询问某个区间内不同的 01 子序列数量,要么把区间翻转. 叉姐的题解: 先考虑怎么算 \(s_1, s_2, \ldots, s_n\)的答案. 设 \(dp(i, 0/1)\) 表示考虑到 \(s_i\) ,以 \(0/1\) 结尾的串的数量. 那么 \(dp(i, 0) =dp(i - 1, 0) + dp(i - 1, 1) + 1\),\(1\)也同理. 那么假设在某个区间之前,\(dp(i, 0…
题目链接 网络赛的水实在太深,这场居然没出线zzz,差了一点点,看到这道题的的时候就剩半个小时了.上面是官方的题意题解,打完了才知道暴力就可以过,暴力我们当时是想出来了的,如果稍稍再优化一下估计就过了zzz.去年有一场现场赛也是n=1000,n^3过了,看来关键时刻实在做不出来就得大胆暴力啊. #include <bits/stdc++.h> using namespace std; typedef long long ll; ; int a[maxn],nex[maxn]; int main…
Theme Section Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 271    Accepted Submission(s): 121 Problem Description It's time for music! A lot of popular musicians are invited to join us in the…
Stone Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 179    Accepted Submission(s): 137 Problem Description Tang and Jiang are good friends. To decide whose treat it is for dinner, they are pla…
Cut the Cake Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 300    Accepted Submission(s): 135 Problem Description MMM got a big big big cake, and invited all her M friends to eat the cake toge…
Poker Shuffle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 95    Accepted Submission(s): 24 Problem Description Jason is not only an ACMer, but also a poker nerd. He is able to do a perfect s…
Flyer Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 386    Accepted Submission(s): 127 Problem Description The new semester begins! Different kinds of student societies are all trying to adver…
Divide Groups Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 423    Accepted Submission(s): 161 Problem Description   This year is the 60th anniversary of NJUST, and to make the celebration mor…
Count The Pairs Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 277    Accepted Submission(s): 150 Problem Description   With the 60th anniversary celebration of Nanjing University of Science…
Walk Through Squares Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 200    Accepted Submission(s): 57 Problem Description   On the beaming day of 60th anniversary of NJUST, as a military colleg…
Two Rabbits Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 505    Accepted Submission(s): 260 Problem Description Long long ago, there lived two rabbits Tom and Jerry in the forest. On a sunny…
Mex Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 623    Accepted Submission(s): 209 Problem Description Mex is a function on a set of integers, which is universally used for impartial game t…
Save Labman No.004 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 624    Accepted Submission(s): 154 Problem Description Due to the preeminent research conducted by Dr. Kyouma, human beings hav…
Zhuge Liang's Mines Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 239    Accepted Submission(s): 110 Problem Description In the ancient three kingdom period, Zhuge Liang was the most famous an…
Caocao's Bridges Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 194    Accepted Submission(s): 89 Problem Description Caocao was defeated by Zhuge Liang and Zhou Yu in the battle of Chibi. But…