日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Lost Array(CF-1043B)

發(fā)布時(shí)間:2025/3/17 编程问答 16 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Lost Array(CF-1043B) 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Problem Description

Bajtek, known for his unusual gifts, recently got an integer array x0,x1,…,xk?1.

Unfortunately, after a huge array-party with his extraordinary friends, he realized that he'd lost it. After hours spent on searching for a new toy, Bajtek found on the arrays producer's website another array aa of length n+1. As a formal description of a?says, a0=0 and for all other i (1≤i≤n) ai=x(i?1)mod k+ai?1, where pmodqpmodq denotes the remainder of division p by q.

For example, if the x=[1,2,3]?and n=5, then:

a0=0,
a1=x0mod3+a0=x0+0=1,
a2=x1mod3+a1=x1+1=3,
a3=x2mod3+a2=x2+3=6,
a4=x3mod3+a3=x0+6=7,
a5=x4mod3+a4=x1+7=9.
So, if the x=[1,2,3] and n=5, then a=[0,1,3,6,7,9].

Now the boy hopes that he will be able to restore x?from a! Knowing that 1≤k≤n, help him and find all possible values of k — possible lengths of the lost array.

Input

The first line contains exactly one integer n (1≤n≤1000) — the length of the array a, excluding the element a0.

The second line contains nn integers a1,a2,…,an (1≤ai≤106).

Note that a0 is always 0 and is not given in the input.

Output

The first line of the output should contain one integer ll denoting the number of correct lengths of the lost array.

The second line of the output should contain ll integers — possible lengths of the lost array in increasing order.

Examples

Input

5
1 2 3 4 5

Output

5
1 2 3 4 5

Input

5
1 3 5 6 8

Output

2
3 5?

Input

3
1 5 3

Output

1
2

題意:給出 n 個(gè)數(shù)以及數(shù)組 a,要求出 x 數(shù)組的長度,并輸出 x 數(shù)組

思路:先根據(jù) a 數(shù)組將所有 x 數(shù)組求出來,然后枚舉長度,依次判斷是否合法即可

Source Program

#include<iostream> #include<cstdio> #include<cstdlib> #include<string> #include<cstring> #include<cmath> #include<ctime> #include<algorithm> #include<stack> #include<queue> #include<vector> #include<set> #include<map> #define PI acos(-1.0) #define E 1e-6 #define MOD 16007 #define INF 0x3f3f3f3f #define N 1001 #define LL long long using namespace std; int a[N]; int sub[N]; int x[N]; int main() {int n;cin>>n;for(int i=1;i<=n;i++){cin>>a[i];sub[i]=a[i]-a[i-1];}int k=0;for(int i=1;i<=n;i++){bool flag=true;for(int j=i+1;j<=n;j++){if(sub[j]!=sub[j-i]){flag=false;break;}}if(flag){k++;x[k]=i;}}cout<<k<<endl;for(int i=1;i<=k;i++)cout<<x[i]<<" ";cout<<endl;return 0; }

?

新人創(chuàng)作打卡挑戰(zhàn)賽發(fā)博客就能抽獎(jiǎng)!定制產(chǎn)品紅包拿不停!

總結(jié)

以上是生活随笔為你收集整理的Lost Array(CF-1043B)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: av第一区| 大地av| 精品久久久久一区二区 | 四虎4hu| 久久精品国产露脸对白 | 国产不卡在线播放 | 日韩欧美一| 伊人天堂在线 | 美女免费福利视频 | 亚洲AV无码成人精品区明星换面 | 一级黄色片欧美 | 欧美一区二区三区黄片 | 老太婆av | 日韩av毛片 | 三级黄色图片 | 男人阁久久 | 欧美三级三级三级爽爽爽 | 欧美中文字幕在线 | 999国产精品| 国产一区免费在线 | 国产精品久久一区 | 国产成人一区二区三区 | 男女国产精品 | 91中文在线观看 | 日韩素人 | 亚洲小视频在线播放 | 波多野结衣二区三区 | 精品成人无码一区二区三区 | 黑人干亚洲人 | 国产色婷婷一区二区 | www.国产精品视频 | 午夜精品视频 | 香蕉视频首页 | 免费操| 欧美天堂在线观看 | 黄色a站 | 色妞网 | 中文字幕不卡在线 | 欧美精品久久久久久久 | 亚洲免费观看 | 欧美日韩一区二区三区免费 | 免费一级特黄特色大片 | 国产乱码精品一区二区三区忘忧草 | 美女18毛片 | 成人看的视频 | 亚洲国产精品麻豆 | 婷婷激情五月 | 亚洲精品成人无码毛片 | 欧美精品一级在线观看 | 黄色一级大片在线免费看国产一 | 1024手机看片国产 | 香蕉午夜视频 | 熟妇人妻va精品中文字幕 | 欧美国产精品久久 | 欧美老女人性生活视频 | eeuss国产一区二区三区 | 毛片的网站 | 极品少妇在线观看 | 日韩电影第一页 | 久久久久久久国产精品毛片 | 亚洲激情视频小说 | 天堂在线一区二区 | 欧美你懂得 | 日韩极品视频在线观看 | 一区二区三区在线观看av | 性激情视频 | 久久久7777 | 亚洲一区二区蜜桃 | 生活片av | 蜜桃视频在线观看一区 | 色网站女女 | 国产精品专区在线观看 | www国产91| 人人干人人澡 | 国产av成人一区二区三区高清 | 人妖一区二区三区 | 玖玖爱国产 | 狠狠做深爱婷婷久久综合一区 | 午夜在线精品偷拍 | 女生被男生c| 国产精品亚洲欧美 | 91精品视频在线 | 国产精品久久久av | 精品久久一区 | 成人激情视频在线播放 | 中文字幕av免费在线观看 | 五月天久久久 | 伊人影视大全 | 99精品国产成人一区二区 | 青青草精品视频 | 欧美在线www | 黄色理伦 | 禁断介护老人中文字幕 | 欧美激情视频一区二区三区在线播放 | 91精产国品一二三区在线观看 | 一级片少妇 | 亚洲美女在线视频 | 久久99精品久久久水蜜桃 | 在线看片中文字幕 |