fork download
  1. #include <bits/stdc++.h>
  2.  
  3. typedef long long ll;
  4.  
  5. using namespace std;
  6.  
  7. ll t, m, n, dp[1000005];
  8.  
  9. int main() {
  10. cin.tie(0) -> sync_with_stdio(false), cout.tie(0);
  11. cin >> t >> m;
  12. m = 1ll << m;
  13. dp[0] = dp[1] = 1;
  14. for (int i = 2; i <= 1000000; i++) {
  15. (dp[i] = dp[i - 1] + dp[i - 2]) %= m;
  16. }
  17. while (t--) {
  18. cin >> n;
  19. cout << dp[n] << ',';
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0.02s 11436KB
stdin
Standard input is empty
stdout
Standard output is empty