【链接】 我是链接,点我呀:)

【题意】

【题解】

枚举k
不难根据a得到x[0..k-1]
然后再根据a[k+1..n]来验证一下得到的x是否正确就好。

【代码】

#include <bits/stdc++.h>
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--) using namespace std; const int N = 1000; int n;
int a[N+10];
int x[N+10];
vector<int> v; int main()
{
ios::sync_with_stdio(0),cin.tie(0);
cin >> n;
rep1(i,1,n) cin >> a[i];
a[0] = 0;
rep1(k,1,n){ /*
x0 x1 x2 x[k-1]
a0 a1 a2 a3.. a[k]
*/
for (int i = 0;i < k;i++){
//a[i+1]=x[i]+a[i]
x[i] = a[i+1]-a[i];
}
int ok = 1;
for (int i = k+1;i <= n;i++)
if (a[i]!=x[(i-1)%k]+a[i-1]){
ok = 0;
}
if (ok) v.push_back(k);
}
cout<<(int)v.size()<<endl;
for (int i = 0;i < (int)v.size();i++){
cout<<v[i]<<' ';
}
return 0;
}

【 Codeforces Round #519 by Botan Investments B】Lost Array的更多相关文章

  1. 【Codeforces Round #519 by Botan Investments E】Train Hard, Win Easy

    [链接] 我是链接,点我呀:) [题意] [题解] 设每个人做第一题.第二题的分数分别为x,y 我们先假设没有仇视关系. 即每两个人都能进行一次训练. 那么 对于第i个人. 考虑第j个人对它的贡献 如 ...

  2. 【Codeforces Round #519 by Botan Investments A】 Elections

    [链接] 我是链接,点我呀:) [题意] [题解] 枚举k 那么另外一个人的得票就是nk-sum(ai) 找到最小的满足nk-sum(ai)>sum(ai)的k就ok了 [代码] #includ ...

  3. 【Codeforces Round #519 by Botan Investments C】 Smallest Word

    [链接] 我是链接,点我呀:) [题意] [题解] 模拟了一两下.. 然后发现. 对于每一个前缀. 组成的新的最小字典序的字符串 要么是s[i]+reverse(前i-1个字符经过操作形成的最大字典序 ...

  4. 【Codeforces Round #519 by Botan Investments D】Mysterious Crime

    [链接] 我是链接,点我呀:) [题意] 相当于问你这m个数组的任意长度公共子串的个数 [题解] 枚举第1个数组以i为起点的子串. 假设i..j是以i开头的子串能匹配的最长的长度. (这个j可以给2. ...

  5. Codeforces Round #519 by Botan Investments

    Codeforces Round #519 by Botan Investments #include<bits/stdc++.h> #include<iostream> #i ...

  6. Codeforces Round #519 by Botan Investments(前五题题解)

    开个新号打打codeforces(以前那号玩废了),结果就遇到了这么难一套.touristD题用了map,被卡掉了(其实是对cf的评测机过分自信),G题没过, 700多行代码,码力惊人.关键是这次to ...

  7. Codeforces Round #519 by Botan Investments F. Make It One

    https://codeforces.com/contest/1043/problem/F 题意 给你n个数,求一个最小集合,这个集合里面数的最大公因数等于1 1<=n<=3e5 1< ...

  8. Codeforces Round #519 by Botan Investments翻车记

    A:枚举答案即可.注意答案最大可达201,因为这个wa了一发瞬间爆炸. #include<iostream> #include<cstdio> #include<cmat ...

  9. 【Codeforces Round #519】

    A:https://www.cnblogs.com/myx12345/p/9872082.html B:https://www.cnblogs.com/myx12345/p/9872124.html ...

随机推荐

  1. Ant报错之out of memory

    用Ant打包一个比較大的项目的时候,遇到OutOfMemory的问题,求助于Google和百度,网上的解决方式非常多,可是个人认为不够具体全面.我的问题须要综合两种方法才解决.把方案记下来.以期帮助大 ...

  2. Hypercall

    在Linux中.大家应该对syscall很的了解和熟悉,其是用户态进入内核态的一种途径或者说是一种方式.完毕了两个模式之间的切换:而在虚拟环境中,有没有一种类似于syscall这样的方式.可以从no ...

  3. HDU 3718 Similarity(KM最大匹配)

    HDU 3718 Similarity 题目链接 题意:给定一个标准答案字符串,然后以下每一行给一个串.要求把字符一种相应一种,要求匹配尽量多 思路:显然的KM最大匹配问题,位置相应的字符连边权值+1 ...

  4. 《解读window核心编程》 之 注冊表

    1 注冊表的作用及组织形式 Windows系统使用注冊表来存储系统和应用程序配置数据.非常多系统和应用程序重要的配置的信息都存储在注冊表中. 注冊表是一种以树型结构组织的数据库.树的每个节点称 作键( ...

  5. Google android source code build 问题总结【转】

    本文转载自:http://light3moon.com/2015/01/31/Google%20android%20source%20code%20build%20%E9%97%AE%E9%A2%98 ...

  6. poj 2763(在线LCA+树状数组)

    Housewife Wind After their royal wedding, Jiajia and Wind hid away in XX Village, to enjoy their ord ...

  7. [NOIP 2014] 寻找道路

    [题目链接] http://uoj.ac/problem/19 [算法] 首先,在反向图上从终点广搜,求出每个点是否可以在答案路径中 然后在正向图中求出源点至终点的最短路,同样可以使用广搜 时间复杂度 ...

  8. 【POJ 3322】 Bloxorz I

    [题目链接] http://poj.org/problem?id=3322 [算法] 广度优先搜索 [代码] #include <algorithm> #include <bitse ...

  9. 优先队列 + 并查集 + 字典树 + 欧拉回路 + 树状数组 + 线段树 + 线段树点更新 + KMP +AC自动机 + 扫描线

    这里给出基本思想和实现代码 . 优先队列 : 曾经做过的一道例题       坦克大战 struct node { int x,y,step; friend bool operator <(no ...

  10. POJ 3083 BFS+DFS 40行

    题意:给你一个迷宫. 先输出当左转优先的时候走的路程长度,再输出当右转优先时走的路程长度,最后输出从起点到终点的最短路程长度. 嗯嗯 奴哥活跃气氛的题.随便写了写.. 此题 知道了思路以后就是水题了. ...