日韩性视频-久久久蜜桃-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ò),歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 中文视频在线观看 | 少妇中文字幕 | 手机在线毛片 | 青青草黄色 | www.黄色片| 亚洲精品在线观 | 日本免费一区二区在线 | 欧美黑人精品一区二区不卡 | 国产日韩视频在线观看 | 久久夜靖品2区 | 久久久亚洲 | 一级黄色片欧美 | 亚洲成人av | 日韩av一区在线播放 | 热99| 久久亚洲成人 | 久久成人资源 | 色网站在线播放 | 国产日韩视频 | 欧美日皮视频 | 亚洲国产成人精品久久 | 免费h漫禁漫天天堂 | 亚洲欧洲精品成人久久奇米网 | 老司机精品福利导航 | 国产成人无码一区二区在线观看 | 日本做爰高潮又黄又爽 | 日日操天天操夜夜操 | 国产又爽又黄视频 | 亚洲av无码一区二区三区网站 | 欧洲亚洲一区二区三区 | 国产精品最新 | 妻子的性幻想 | 8mav在线 | 久久精品这里只有精品 | 在线观看欧美国产 | 精品国产视频一区二区 | 国产精品天美传媒 | 九九综合九九综合 | 欧美激情另类 | a一级黄色片| 黄色a一片 | 尤物最新网址 | 99国产精品 | 国产免费成人在线视频 | 免费萌白酱国产一区二区三区 | 揉我啊嗯~喷水了h视频 | 特黄做受又粗又大又硬老头 | 在线日韩精品视频 | 性色欲情网站iwww九文堂 | 黄页av | 91麻豆精品久久久久蜜臀 | 国产福利一区在线 | 丰满少妇av| 国产免费不卡av | www.99爱| 污视频网站免费看 | 99国产一区 | www.夜夜爱| 处破痛哭a√18成年片免费 | 在线观看视频99 | 在线观看av的网址 | 亚日韩欧美 | 日本少妇与黑人 | 在线国产不卡 | 91精品国产综合久久久蜜臀九色 | 国产亚洲精品久久 | 日产精品一区 | 国产裸体视频 | 欧美精品一区二区三区久久久竹菊 | 国产精品一区二区视频 | 九九热这里有精品 | 天堂va蜜桃一区二区三区漫画版 | 麻豆系列在线观看 | 四虎影院永久地址 | 少妇高潮毛片色欲ava片 | 亚洲av无码一区二区三区网站 | 欧美日韩三级在线观看 | 妺妺窝人体色www聚色窝仙踪 | 一级黄色视 | 成人合集 | 午夜91视频| 久久αv | 成人欧美精品一区二区 | 欧洲av片| 内射毛片内射国产夫妻 | 国产情侣在线播放 | 狠狠躁狠狠躁视频专区 | 日韩1024| 日韩激情综合 | 理论片中文字幕 | av性天堂网 | 91爱啪啪 | 91性色| 日本黄色免费大片 | 欧美在线导航 | 国产盗摄一区二区三区在线 | 森泽佳奈av| av免费片 | 日韩中文字幕一区 |