A. Lesha and array splitting time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output One spring day on his way to university Lesha found an array A. Lesha likes to split arrays into several parts.…
题目链接 Lesha and array splitting 设s[i][j]为序列i到j的和,当s[i][j]≠0时,即可从i跳到j+1.目标为从1跳到n+1,所以按照题意暴力即可. #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i(a); i <= (b); ++i) #define dec(i,a,b) for(int i(a); i >= (b); --i) + ; stru…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output One spring day on his way to university Lesha found an array A. Lesha likes to split arrays into several parts. This time Lesha decided to split…
http://codeforces.com/contest/754/problem/A 题意: 给出一串序列,现在要把这串序列分成多个序列,使得每一个序列的sum都不为0. 思路: 先统计一下不为0的数,只要有一个不为0的数,那么就能分割. 如果一个数不为0,则让它单独成为一组,如果它后面有0,则把它后面的连续的0也归到这一组中. 特别要注意一下的是,序列一开始就是0的情况. #include<iostream> #include<algorithm> #include<cs…
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company. To settle this problem, they've decided to play…
题目: 题目原文链接:http://codeforces.com/contest/845/problem/C 题意:现在我们有一个电视清单,有两个电视,电视清单上有每一个节目的开始时间和结束时间. 电视不能接连不间断的播放,例如TV1播放完1-2点的节目后不能接着播放2-3点的电视,除非在TV2上播放,如果TV2也正在播放则不能播放完清单. 思路: 1.对清单排序,让开始时间早的靠前,如果开始时间相同,结束时间早的靠前. 2.如果TV1已经结束.就把这一个节目的结束时间赋给TV1,然后看下一个节…
题目链接:http://codeforces.com/contest/402/problem/D 题意:给出一个a串和素数串b .f(1) = 0; p为s的最小素因子如果p不属于b , 否则 . a串还可以进行这样的操作找一个r使得(1<=r<=n)g=gcd(a[1],a[2]......a[r]),然后再是a[1~r]/g. 题解:其实f的求和可以理解为num1(好的素因子)-num2(不好的素因子). 然后就是对a操作的理解,a怎么样才需要进行这样的操作呢?只要g中不好的素因子大于好的…
题目描述: Maxim and Array time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Recently Maxim has found an array of n integers, needed by no one. He immediately come up with idea of changing it: he…
应该是做麻烦了,一开始还没A(幸好上一次比赛水惨了) #include<bits/stdc++.h> #define lowbit(x) x&(-x) #define LL long long #define N 200005 #define M 1000005 #define mod 2147483648LL #define inf 0x7ffffffff using namespace std; inline int ra() { ,f=; char ch=getchar(); ;…
C. Array Splitting You are given a sorted array…