FOJ-2013 A Short Problem (前缀和)】的更多相关文章

题目传送门 /* 题意:取长度不小于m的序列使得和最大 贪心:先来一个前缀和,只要长度不小于m,从m开始,更新起点k最小值和ans最大值 */ #include <cstdio> #include <algorithm> using namespace std; ; const int INF = 0x3f3f3f3f; int a[MAXN], sum[MAXN]; int main(void) //FZU 2013 A short problem { // freopen (&…
Problem Description The description of this problem is very short. Now give you a string(length N), and ask you the max sum of the substring which the length can't small than M. Input The first line is one integer T(T≤20) indicates the number of the…
题目链接:https://vjudge.net/problem/FZU-2013  Problem 2013 A short problem Accept: 356    Submit: 1083Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description The description of this problem is very short. Now give you a string(length N), an…
A Short problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1716    Accepted Submission(s): 631 Problem Description According to a research, VIM users tend to have shorter fingers, compared…
A Short problem                                                          Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)                                                                                      Total Su…
HDU 4291 A Short problem(2012 ACM/ICPC Asia Regional Chengdu Online) 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=4291 Description 给一个式子求结果.类似Fibonacci的公式g(n)=3*g(n-1)+g[n-2]. Input 给你n(1<=n<=1e18) Output 求g(g(g(n))) Sample Input 样例第一个就是0什么鬼,虽然没影响.…
A Short problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2711    Accepted Submission(s): 951 Problem Description According to a research, VIM users tend to have shorter fingers, compared…
A Short problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2461    Accepted Submission(s): 864 Problem Description According to a research, VIM users tend to have shorter fingers, compared…
A Short problem Problem's Link Mean: 给定一个n,求:g(g(g(n))) % 1000000007 其中:g(n) = 3g(n - 1) + g(n - 2),g(1) = 1,g(0) = 0 analyse: 很经典的题.由于n特别大,直接求肯定不行.由于所有的模运算都会出现循环节,可以求出循环节. 由于模数是固定的,可以在本地暴力求出循环节. 对于1000000007,求得循环节为222222224: 对于222222224,求得循环节183120:…
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2383    Accepted Submission(s): 833 Problem Description According to a research, VIM users tend to have shorter fingers, compared with Emacs user…
转载自https://blog.csdn.net/weixin_37517391/article/details/83821752 题解 其实这题不难,只要想到了前缀和差分就基本OK了. 我们要求的是第$i$项的式子: $F(i)=(a_1+a_2+...+a_i)^k+(a_2+...+a_i)^k+...+a_i^k$ 记$S_i = a_1 + a_2 +...+a_i,S_0=0$ $F(i) = (S_i-S_0)^k+(S_i-S_1)^k+...+(S_i-S_{i-1})^k$…
这套题目还是比较吊的,由于我的沙茶,还是很多没有做出来- -! C:逆序数 D:呵呵 A:妈蛋,自己精度没弄好,想到之前GCC的要加eps,就WA了几次后交Visual C++过了!C(n,m)p^m(1-p)^(n-m)(m to n) G/H:这题傻逼,没想出来,设x为获奖的人,n为总人数,按先每人5 4 3题的出剩下的题目给出0 1 2的人出剩下的题s满足<=2*(n-x)也就是没有奖的人,因为没奖的最多只能两题,然后从小枚举x第一个符合的就是最小的! s+=max((num[j]-i),…
数学题,找循环节!! 首先g(g(g(n)))=g(x) mod 1e9+7 则可知x有循环节1e9+7; 之后x=g(g(n)),则可算出g(n)的循环节,在算出n的循环节就可以了!! 代码如下: #include<iostream> #include<stdio.h> #include<algorithm> #include<iomanip> #include<cmath> #include<cstring> #include&l…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4291 题目意思:求g(g(g(n))) mod 109 + 7,其中g(n) = 3g(n - 1) + g(n - 2),g(1) = 1,g(0) = 0. 思路:一个很简单的矩阵快速幂,简单的想法就是先用n算出g(n),然后再算g(g(n)),然后再算最外层,都是mod(1e9+7),这么做就错了,这道题有一个循环节的问题,看来这种嵌套的递推式取mod是存在循环节的,以后要注意下. 计算循环节…
题意: 给出递推式 g(n) = 3g(n - 1) + g(n - 2),且g(1) = 1,g(0) = 0.求g( g( g(n))) mod 109 + 7. 思路: 要求的g( g( g(n)))一共里外3层.看到时间限制1s,数据最大10^18,必定不能老实递推,要么有循环,要么用通项公式.这里用通项公式太麻烦了,数字不好算,而g(n)%109 + 7是有规律的, 在n=222222224之后会出现循环,也就是n=0和n=222222224的g(n)是一样的,这是最外层.那么也就是说…
A Short problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1110    Accepted Submission(s): 436 Problem Description According to a research, VIM users tend to have shorter fingers, compared…
100 numpy exercises A joint effort of the numpy community The goal is both to offer a quick reference for new and old users and to provide also a set of exercices for those who teach. If you remember having asked or answered a (short) problem, you ca…
二. 控制流 statement:一个单独的R语句或者是一个复合的R语句: cond:条件表达式,为TRUE或FALSE: expr:数字或字符表达式: seq:数字或字符串的顺序. 1.循环语句:for,while (1)for(var in seq)  statement for(i in 1:10) + print("Hello R") [1] "Hello R" [1] "Hello R" [1] "Hello R"…
第一部分 基础 第1章 导论 (已看) 第2章 专业工具 (已看) 第3章 游戏软件工程基础 (已看) 第4章 游戏所需的三维数学 (已看) 第二部分 低阶引擎系统 第5章 游戏支持系统 (已看) 第6章 资源及文件系统 (已看) 第7章 游戏循环及实时模拟 (已看) 第8章 人体学接口设备(HID) (已看) 第9章 调试及开发工具 (已看) 第三部分 图形及动画 第10章 渲染引擎 第11章 动画系统 (已看) 第12章 碰撞及刚体动力学 (已看) 第四部分 游戏性 第13章 游戏性系统简介…
最近做一个升级的CRM项目,为了区分哪些是新增的,所以决定用一个新的前缀来定义实体及新加的字段.之前用的是new_开头,现在改成tm_开头.   原来只要是新建实体或字段都是new_开头:   1. 首先查看当前的publisher:   2. 打开Settings –> Customization –> publishers, 找到上面显示的publisher,双击打开   3. 把Prefix从new修改为tm 4. 再次新建实体或字段,就是以tm开头了:     Dynamic CRM…
Problem 2020 组合 Accept: 714    Submit: 1724Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description 给出组合数C(n,m), 表示从n个元素中选出m个元素的方案数.例如C(5,2) = 10, C(4,2) = 6.可是当n,m比较大的时候,C(n,m)很大!于是xiaobo希望你输出 C(n,m) mod p的值!  Input 输入数据第一行是一个正整数T,表示数据组…
Problem A Almost Palindrome Given a line of text, find the longest almost-palindrome substring. A string S is almost-palindrome if S begins and ends with a letter, and a(S) and b(S) have at most 2k positions with different characters Here a(S) is the…
Problem F Funny Car Racing There is a funny car racing in a city with n junctions and m directed roads. The funny part is: each road is open and closed periodically. Each road is associate with two integers (a, b), that means the road will be open fo…
Problem H High bridge, low bridge Q: There are one high bridge and one low bridge across the river. The river has flooded twice, why the high bridge is flooded twice but the low bridge is flooded only once? A: Because the lower bridge is so low that…
Problem I Interesting Calculator There is an interesting calculator. It has 3 rows of button. Row 1: button 0, 1, 2, 3, ..., 9. Pressing each button appends that digit to the end of the display. Row 2: button +0, +1, +2, +3, ..., +9. Pressing each bu…
Problem J Joking with Fermat's Last Theorem Fermat's Last Theorem: no three positive integers a, b, and c can satisfy the equation an + bn = cn for any integer value of n greater than two. From the theorem, we know that a3 + b3 = c3 has no positive i…
Problem G Good Teacher I want to be a good teacher, so at least I need to remember all the student names. However, there are too many students, so I failed. It is a shame, so I don't want my students to know this. Whenever I need to call someone, I c…
Problem L Last Blood In many programming contests, special prizes are given to teams who solved a particular problem first. We call the first accepted solution "First Blood". It's an interesting idea to set prizes for "Last Blood". The…
Problem C Character Recognition? Write a program that recognizes characters. Don't worry, because you only need to recognize three digits: 1, 2 and 3. Here they are: .*. *** *** .*. ..* ..* .*. *** *** .*. *.. ..* .*. *** *** Input The input contains…
题目链接: 题目 Problem 1016 咒文卷轴 Time Limit: 3000 mSec Memory Limit : 131072 KB 问题描述 小Y 是一个魔法师,有一天他获得了一卷神秘而古老的咒文卷轴,其由N个咒文构成,每一个咒文都有一个威力值ai, 现在小Y可以借助该卷轴释放强力的魔法,一个魔法必须由编号连续的一段的.长度大于等于L且小于等于R的咒文构成,该魔法的威力为构成该魔法的每一个咒文的威力的总和,现在小Y想要释放K个不同的魔法,问最大能产生多大的威力值,若两个魔法是相同…