Codeforces 25E Test E. Test Sometimes it is hard to prepare tests for programming problems. Now Bob is preparing tests to new problem about strings - input data to his problem is one string. Bob has 3 wrong solutions to this problem. The first gives…
[题目大意] 已知多项式方程:a0+a1*x+a2*x^2+...+an*x^n=0.求这个方程在[1,m]内的整数解(n和m均为正整数). [思路] *当年考场上怒打300+行高精度,然而没骗到多少orz 然而正解只有60+行 [前铺]f(n) mod p=f(n mod p) mod p 取四个素数,分别对每个ai取模.先预处理x=0..p-1的情况,直接代入多项式计算即可.再在O(m)时间内检验1..m,对于≥p的利用前铺公式可得.如果模四个素数结果均能得到0,说明这个数是方程的解. P.…
[哈希和哈希表]Seek the Name, Seek the Fame 题目描述 The little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born babies. They seek the name, and at the same time seek the fame.…
题意: When given an array (a0,a1,a2,⋯an−1) and an integer K, you are expected to judge whether there is a pair (i,j)(0≤i≤j<n) which makes that NP−sum(i,j) equals to K true. Here NP−sum(i,j)=ai−ai+1+ai+2+⋯+(−1)j−iaj 1≤n≤1000000,−1000000000≤ai≤1000000000…
Ultra-QuickSort Time Limit: 7000MS Memory Limit: 65536K Total Submissions: 39529 Accepted: 14250 Description In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swappin…
A. k-rounding time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output For a given positive integer n denote its k-rounding as the minimum positive integer x, such that x ends with k or more zeros i…
C. Journey time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output There are n cities and n - 1 roads in the Seven Kingdoms, each road connects two cities and we can reach any city from any other…
How many Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4210 Accepted Submission(s): 1936 Problem Description Give you n ( n < 10000) necklaces ,the length of necklace will not large than 10…
1077 Kuchiguse (20 分) The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker's personality. Such a preference is called "Kuchiguse" and is ofte…
Palindrome Time Limit: 15000MS Memory Limit: 65536K Total Submissions: 13157 Accepted: 5028 Description Andy the smart computer science student was attending an algorithms class when the professor asked the students a simple question, "Can you pr…
1401 兔子与兔子 0x10「基本数据结构」例题 描述 很久很久以前,森林里住着一群兔子.有一天,兔子们想要研究自己的 DNA 序列.我们首先选取一个好长好长的 DNA 序列(小兔子是外星生物,DNA 序列可能包含 26 个小写英文字母),然后我们每次选择两个区间,询问如果用两个区间里的 DNA 序列分别生产出来两只兔子,这两个兔子是否一模一样.注意两个兔子一模一样只可能是他们的 DNA 序列一模一样. 输入格式 第一行一个 DNA 字符串 S.接下来一个数字 m,表示 m 次询问.接下来 m…
Snowflake Snow Snowflakes Time Limit: 4000MS Memory Limit: 65536K Total Submissions: 49991 Accepted: 13040 Description You may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true.…
Codeforces 1012C Hills Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis…