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

【题意】

【题解】

枚举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. android自带的处理Bitmap out Memory 的处理,我仅仅是改变了些写法成为自己用的东西

    每天上万次的启动载入证明这个载入是不错的; 第三方的载入框架非常多,推荐使用成熟框架,比方大家都知道的ImageLoad等, 这里的仅仅供学习; 我也曾在一个菜谱的项目里写过载入手机相冊图片的,只是当 ...

  2. hdu1035 Robot Motion (DFS)

    Robot Motion Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tot ...

  3. linux下dd命令详解【转】

    本文转载自:http://www.cnblogs.com/licheng/articles/1116492.html  名称: dd 使用权限: 所有使用者dd 这个指令在 manual 里的定义是 ...

  4. succ

  5. 0605-类的继承、重写、parent、final

    定义一个子类(man) //定义一个类 class renlei{ var $name = '王五'; var $age = ''; var $sex = ''; var $todo = ''; fu ...

  6. Appium + python -小程序实例

    from appium import webdriverfrom appium.webdriver.common.touch_action import TouchActionfrom time im ...

  7. js中 if不判断解决方式

    $(function() { $("#number").blur(function() { var number = $('#number').val(); var num = $ ...

  8. iTex导出PDF

    iText导出PDF,所需jar包如下: itext-asian-5.2.0.jar 支持导出中文的jar包 itextpdf-5.5.9.jar PDF核心jar包 bcprov-jdk15on-1 ...

  9. ROS-URDF-Gazebo

    前言:在gazebo里运行urdf文件 一.安装教程包 cd ~/catkin_test/srcgit clone https://github.com/ros/urdf_sim_tutorial.g ...

  10. lnmp 安装FTP服务 并配置FTP用户

    lnmp 默认是不带FTP服务的,需要的童鞋要自行安装.步骤也很简单 一,进入lnmp目录,找到pureftpd.sh 二,直接运行该脚本 ./pureftpd.sh 按任意键开始安装,等待,安装成功 ...