hdu 4506 小明系列故事——師兄幫幫忙

來源:互聯網
上載者:User

標籤:style   blog   http   color   os   io   for   div   

題目連結:http://acm.hdu.edu.cn/showproblem.php?pid=4506

題目大意;找規律,判斷k的t次冪前面的係數。

 1 #include <iostream> 2 #include <cstdio> 3 using namespace std; 4  5 __int64 fun(__int64 a,__int64 b) 6 { 7     __int64 s=1; 8     while (b) 9     {10         if (b%2==1)11             s=s*a%1000000007;12         a=a*a%1000000007;13         b>>=1;14     }15     return s%1000000007;16 }17 18 int main ()19 {20     int T;21     __int64 a[10100];22     scanf("%d",&T);23     while (T--)24     {25         __int64 n,t,k;26         scanf("%I64d%I64d%I64d",&n,&t,&k);27         k=fun(k,t);28         for (int i=0; i<n; i++)29         {30             scanf("%I64d",&a[i]);31             a[i]=a[i]*k%1000000007;32         }33         t%=n;34         printf("%I64d",a[(n+0-t)%n]);35         for(int i=1; i<n; i++)36             printf(" %I64d",a[(n+i-t)%n]);37         printf ("\n");38     }39     return 0;40 }

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.