codeforces 327 B. Hungry Sequence】的更多相关文章

题目链接 题目就是让你输出n个数的序列,要保证该序列是递增的,并且第i个数的前面不能保护它的约数,我直接先对前100000的素数打表,然后输出前n个,so easy. //cf 191 B #include <stdio.h> #include <string.h> int ans[100005]; bool vis[10000000]; int main() { int cnt = 1; for (int i = 2; i < 1300000; i++) { if (vis…
. Hungry Sequence time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub and Iahubina went to a date at a luxury restaurant. Everything went fine until paying for the food. Instead of money,…
B. Hungry Sequence time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub and Iahubina went to a date at a luxury restaurant. Everything went fine until paying for the food. Instead of money…
题目链接:Codeforces 486E LIS of Sequence 题目大意:给定一个数组.如今要确定每一个位置上的数属于哪一种类型. 解题思路:先求出每一个位置选的情况下的最长LIS,由于開始的想法,所以求LIS直接用线段树写了,没有改,能够用 log(n)的算法直接求也是能够的.然后在从后向前做一次类似LIS.每次推断A[i]是否小于f[dp[i]+1],这样就能够确定该位 置是否属于LIS序列. 然后为第三类的则说明dp[i] = k的仅仅有一个满足. #include <cstdi…
题目链接:http://codeforces.com/problemset/problem/327/B 这道题目虽然超级简单,但是当初我还真的没有想出来做法,囧,看完别人的代码恍然大悟. #include <cstdio> #include <cstdlib> #include <cmath> int main(void) { int n; scanf("%d", &n); ; i <= n+n; ++i) { printf("…
E. Correct Bracket Sequence Editor time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Recently Polycarp started to develop a text editor that works only with correct bracket sequences (abbrev…
C. Sequence Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100114 Description Integer sequences are very interesting mathematical objects. Let us examine a sequence generated with the use of two operations: doubling and “digit…
http://codeforces.com/contest/327/problem/B 这道题素数打表就行. #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #define maxn 2000100 using namespace std; bool f[maxn]; int a[maxn]; int t; void prime() { memset(…
A.Infinite Sequence time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Consider the infinite sequence of integers: 1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5.... The sequence is built in the…
题目链接: A. Infinite Sequence time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya likes everything infinite. Now he is studying the properties of a sequence s, such that its first element is…