Chef and Strange Operations | Codechef

Chef and Strange Operations | Codechef

2/8/2016 Chef and Strange Operations | CodeChef Login Signup PRACTICE COMPETE DISCUSS COMMUNITY HELP ABOUT Home » Compete » February Challenge 2016 » Chef and Strange Operations Chef and Strange Operations ALL SUBMISSIONS Problem code: STROPR Tweet https://www.codechef.com/FEB16/problems/STROPR 1/3 2/8/2016 Chef and Strange Operations | CodeChef Read problems statements in Mandarin Chinese, Russian and Vietnamese as SUCCESSFUL SUBMISSIONS well. Chef has an array A consisting of N integers (1­based indexing). He asks you to perform the following operation M times: for i = 2 to N: Ai = Ai + Ai­1 th Your task is to find the x element of the array (i.e., Ax) after performing the above operation M times. As the answer could be large, please output it modulo 109 + 7. Input The first line of input contains an integer T denoting the number of test cases. The first line of each test case contains three space­separated integers — N, x, and M — denoting the size of the array, index of the element you need to find, and the amount of times you need to repeat operation before finding the element, respectively. The second line contains N space­separated integers A1, A2, …, AN. Output 9 For each test case, output a single line containing one integer: Ax modulo 10 + 7. Constraints 1 ≤ T ≤ 10 1 ≤ x ≤ N ≤ 105 1 ≤ M ≤ 1018 1 ≤ A ≤ 1018 i Subtasks Subtask 1 (8 points): 1 ≤ x ≤ min{2, N} Subtask 2 (24 points): 1 ≤ N * M ≤ 106 Subtask 3 (68 points): No additional constraints Example Input: 2 3 2 3 1 2 3 3 3 3 1 2 3 Output: 5 15 Explanation Values in the array A: Before the operations: [1, 2, 3] After the first operation: [1, 3, 6] After the second operation: [1, 4, 10] After the third operation: [1, 5, 15] Since input file can be fairly large (about 8 MB), it's recommended to use fast I/O (for example, in C++, use scanf/printf instead of cin/cout). Author: antoniuk1 Tester: iscsi Date Added: 23­01­2015 Time Limit: 2 sec Source Limit: 50000 Bytes ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 4.9.2, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, Languages: NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYPY, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM chicken, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC SUBMIT Comments CodeChef is a non­commercial competitive programming community https://www.codechef.com/FEB16/problems/STROPR 2/3 2/8/2016 Chef and Strange Operations | CodeChef About CodeChef About Directi CEO's Corner C­Programming Programming Languages Contact Us © 2009 Directi Group . All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs The time now is: 05:52:14 PM In order to report copyright violations of any kind, send in an email to [email protected] Your IP : 14.99.82.107 CodeChef ­ A Platform for Aspiring Programmers CodeChef was created as a platform to help programmers make it big in the world of algorithms, computer programming and programming contests. At CodeChef we work hard to revive the geek in you by hosting a programming contest at the start of the month and another smaller programming challenge in the middle of the month. We also aim to have training sessions and discussions related to algorithms, binary search, technicalities like array size and the likes. Apart from providing a platform for programming competitions, CodeChef also has various algorithm tutorials and forum discussions to help those who are new to the world of computer programming. Practice Section ­ A Place to hone your 'Computer Programming Skills' Try your hand at one of our many practice problems and submit your solution in a language of your choice. Our programming contest judge accepts solutions in over 35+ programming languages. Preparing for coding contests were never this much fun! Receive points, and move up through the CodeChef ranks. Use our practice section to better prepare yourself for the multiple programming challenges that take place through­out the month on CodeChef. Compete ­ Monthly Programming Contests and Cook­offs Here is where you can show off your computer programming skills. Take part in our 10 day long monthly coding contest and the shorter format Cook­off coding contest. Put yourself up for recognition and win great prizes. Our programming contests have prizes worth up to INR 20,000 (for Indian Community), $700 (for Global Community) and lots more CodeChef goodies up for grabs. Programming Tools Practice Problems Initiatives Online IDE Easy Go for Gold Upcoming Coding Contests Medium CodeChef for Schools Contest Hosting Hard Campus Chapters Problem Setting Challenge CodeChef Tutorials Peer CodeChef Wiki School FAQ's https://www.codechef.com/FEB16/problems/STROPR 3/3.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    3 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us