首頁 > web前端 > html教學 > Codeforces Round #254 (Div. 2)D(估计)_html/css_WEB-ITnose

Codeforces Round #254 (Div. 2)D(估计)_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
發布: 2016-06-24 11:57:43
原創
1113 人瀏覽過

D. DZY Loves FFT

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

DZY loves Fast Fourier Transformation, and he enjoys using it.

Fast Fourier Transformation is an algorithm used to calculate convolution. Specifically, if a, b and c are sequences with length n, which are indexed from 0 to n?-?1, and

We can calculate c fast using Fast Fourier Transformation.

DZY made a little change on this formula. Now

To make things easier, a is a permutation of integers from 1 to n, and b is a sequence only containing 0 and 1. Given a and b, DZY needs your help to calculate c.

Because he is naughty, DZY provides a special way to get a and b. What you need is only three integers n, d, x. After getting them, use the code below to generate a and b.

//x is 64-bit variable;function getNextX() {    x = (x * 37 + 10007) % 1000000007;    return x;}function initAB() {    for(i = 0; i     <p> Operation x % y denotes remainder after division x by y. Function swap(x, y) swaps two values x and y.</p>      <p class="sycode">    </p><p class="sycode">     Input    </p>    <p> The only line of input contains three space-separated integers n,?d,?x (1?≤?d?≤?n?≤?100000; 0?≤?x?≤?1000000006). Because DZY is naughty, x can't be equal to 27777500.</p>      <p class="sycode">    </p><p class="sycode">     Output    </p>    <p> Output n lines, the i-th line should contain an integer ci?-?1.</p>      <p class="sycode">    </p><p class="sycode">     Sample test(s)    </p>    <p class="sycode">     </p><p class="sycode">      </p><p class="sycode">       input      </p>      <pre style="代码" class="precsshei">3 1 1
登入後複製

output

132
登入後複製

input

5 4 2
登入後複製

output

22455
登入後複製

input

5 4 3
登入後複製

output

55554
登入後複製

题意:RT


思路:因为b序列一定只含0或1,那么含0的是没有意义的


            直接for就好了,然后用一个数组is[]记录前多少个b序列为1的位置


            每次要找最大值的时候,如果is[]数组的个数小于一个常数,就枚举is数组


            否则直接从大到小枚举最大值就好了


相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
"Icinga Mysql 遷移錯誤:引擎中缺少表格"
來自於 1970-01-01 08:00:00
0
0
0
WebGL不支援使用索引255進行索引繪製
來自於 1970-01-01 08:00:00
0
0
0
java - springboot新手學習
來自於 1970-01-01 08:00:00
0
0
0
spring - JavaWeb中 Service 層的事務問題
來自於 1970-01-01 08:00:00
0
0
0
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板