HDU4648+Easy
N^2都能过!!!!!!!
/*
Easy
*/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<iostream>
#include<queue>
#include<map>
#include<stack>
#include<set>
#include<math.h>
using namespace std;
typedef long long int64;
//typedef __int64 int64;
typedef pair<int64,int64> PII;
#define MP(a,b) make_pair((a),(b))
const int maxn = 100005;
const int inf = 0x7fffffff;
const double pi=acos(-1.0);
const double eps = 1e-8;
int a[ maxn ];
int sum[ maxn ];
int main(){
int n,mod;
while( scanf("%d%d",&n,&mod)==2 ){
sum[ 0 ] = 0;
for( int i=1;i<=n;i++ ){
scanf("%d",&a[i]);
sum[ i ] = sum[ i-1 ]+a[ i ];
}
int M = 0;
for( int i=1;i<=n;i++ ){
for( int j=1;j<=i&&(i-j+1>M);j++ ){
if( (sum[i]-sum[j-1])%mod==0 ){
M = i-j+1;
}
}
}
printf("%d\n",M);
}
return 0;
}
HDU4648+Easy的更多相关文章
- 【转】Windows下使用libsvm中的grid.py和easy.py进行参数调优
libsvm中有进行参数调优的工具grid.py和easy.py可以使用,这些工具可以帮助我们选择更好的参数,减少自己参数选优带来的烦扰. 所需工具:libsvm.gnuplot 本机环境:Windo ...
- Struts2 easy UI插件
一.easy UI是类似于jQuery UI的插件库,它提供了丰富的各种常用插件:tree.datagrid... tree插件: 语法:$(selector).tree([settings]); 常 ...
- Easy UI常用插件使用
一.easy UI是类似于jQuery UI的插件库,它提供了丰富的各种常用插件:tree.datagrid... tree插件: 语法:$(selector).tree([settings]); 常 ...
- UVA-11991 Easy Problem from Rujia Liu?
Problem E Easy Problem from Rujia Liu? Though Rujia Liu usually sets hard problems for contests (for ...
- CodeForces462 A. Appleman and Easy Task
A. Appleman and Easy Task time limit per test 1 second memory limit per test 256 megabytes input sta ...
- easy ui插件
简介: easy UI是类似于jQuery UI的插件库 注意:多脚本同时使用时,注意脚本冲突问题. 常用插件: 1.tree插件(tree插件实现动态树形菜单) 2.datagrid插件(datag ...
- 用TPP开启TDD的easy模式
Test-Drived Development 测试驱动开发三步曲:写一个失败的测试用例->编写生产代码通过这个测试用例(transformation)->重构(refactor).重构是 ...
- Easy Sysprep更新日志-skyfree大神
Easy Sysprep更新日志: Skyfree 发表于 2016-1-22 13:55:55 https://www.itsk.com/forum.php?mod=viewthread&t ...
- [官方软件] Easy Sysprep v4.3.29.602 【系统封装部署利器】(2016.01.22)--skyfree大神
[官方软件] Easy Sysprep v4.3.29.602 [系统封装部署利器](2016.01.22) Skyfree 发表于 2016-1-22 13:55:55 https://www.it ...
随机推荐
- 1.语言概述-JavaScript权威指南笔记
上周三的时候交给老板目前的项目第一个迭代回顾会的总结.原本是以综述性的表述方式写的,交给他之后表示程序员不要长篇大论.总结要分为优点缺点期望等等块,每块列出条目,简明扼要的表达出来.这里也用这种风格. ...
- Mysql 正则表达式 判断字段值不包含数字
SELECT * FROM (select replace(FlightId_IaTa,LEFT(FlightId_IaTa,2),'') as aa,FlightId_IaTa,FlightIdfr ...
- zoj 3708 Density of Power Network
/*看英文和图我头都大了,不过很简单的.*/ #include<string.h> #include<stdio.h> ][],q[],w[]; int main(int ar ...
- iOS中UIWebView使用JS交互 - 机智的新手
iOS中偶尔也会用到webview来显示一些内容,比如新闻,或者一段介绍.但是用的不多,现在来教大家怎么使用js跟webview进行交互. 这里就拿点击图片获取图片路径为例: 1.测试页面html & ...
- ##DAY2 UILabel、UITextField、UIButton、UIImageView、UISlider
##DAY2 UILabel.UITextField.UIButton.UIImageView.UISlider #pragma mark ———————UILabel——————————— UILa ...
- UVa1225 Digit Counting
#include <stdio.h>#include <string.h> int main(){ int T, N, i, j; int a[10]; sc ...
- PHP-购物网站开发设计(一)
2015-07-6 开始使用PHP完成简单购物网站的设计,首先要选择合适的软件平台,所以今天先记录平台的选择与搭建: 我选择使用Apache24 + PHP 5.6 + MySQL 开发环境完成PHP ...
- HDU1171-Big Event in HDU
描述: Nowadays, we all know that Computer College is the biggest department in HDU. But, maybe you don ...
- jbpmAPI-7
7.1. Introduction 业务流程的一个重要方面是人工任务管理.虽然一些执行的工作过程中可以自动执行一些任务需要执行的人类演员.jBPM支持特殊的人工任务节点内部流程建模与人类用户交互.这个 ...
- Linux 网络编程: daytime Service
前言 如果你这段时间过得很舒服,那就证明你荒废以一段时间.如果你这段时间过得很辛苦,那么恭喜,你又进步了.最近入党的事情忙得焦头烂额,博客也拖了好久没写,主要也是因为要装 xinetd 服务一直没装好 ...