首页 > TAG信息列表 > Ilya
B. Ilya and Queries(前缀和)
题意:输入一串字符,有n次查询,每次输入l,r。求在从l到r的范围内,满足前一个字符和后一个字符相同的条件的字符有多少个。 题解:最开始用暴力遍历,然后超时了。应该使用前缀和(类似前缀和的一个东西?),在输入的时候,就可以判断前一个字符和这一个字符是否相同,然后累加符合条件的和。当查询到对【CodeForces - 518D】Ilya and Escalator(概率dp,数学期望)
题干: Ilya got tired of sports programming, left university and got a job in the subway. He was given the task to determine the escalator load factor. Let's assume that n people stand in the queue for the escalator. At each second one of the two followURAL1088 Ilya Murometz
原文链接:http://www.cnblogs.com/xiao_wu/archive/2010/05/23/1742317.html http://acm.timus.ru/problem.aspx?space=1&num=1088 题目描述太过分,黑书上有译题,但是翻译的太过分,于是基本读不懂,直接罪恶的看这个吧: http://www.nocow.题解 CF1119A 【Ilya and a Colorful Walk】
此题就是:给你一个数组,让你找出两个不同的元素,并让它们的下标差距最大。 思路:从2到n,如果与1不同,记录距离,与原数比较,取大。 从1到n-1,如果与n不同,记录距离,与原数比较,取大。 AC代码(你们最想要的) #include<bits/stdc++.h>using namespace std;int main(){ int n,a[300010],i,ans=0Codeforces Global Round 2
本来想一场上紫;真没想到结果集体凉凉 A. Ilya and a Colorful Walk Ilya lives in a beautiful city of Chordalsk. There are nn houses on the street Ilya lives, they are numerated from 11 to nn from left to right; the distance between every two neighboring h