Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1.  
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. #define RANGE 1100001
  7. #define MOD 100000
  8.  
  9. int fib[RANGE];
  10.  
  11. int main()
  12. {
  13.     ios_base::sync_with_stdio(false);
  14.     int T,i,j,A,B,x;
  15.     cin>>T;
  16.     fib[0]=1;
  17.     fib[1]=0;
  18.     fib[2]=1;
  19.     for(i=3;i<=RANGE;i++)
  20.     {
  21.         fib[i]=(fib[i-1]+fib[i-2])%MOD;
  22.     }
  23.     for(i=1;i<=T;i++)
  24.     {
  25.         priority_queue <int> PQ;
  26.         cin>>A>>B;
  27.         cout<<"Case "<<i<<":";
  28.         for(j=A;j<=(A+B);j++)
  29.         {
  30.             PQ.push(-fib[j]);
  31.         }
  32.         x=PQ.size();
  33.         if(x>100)
  34.         {
  35.             x = 100;
  36.         }
  37.         while(x--)
  38.         {
  39.             cout<<" "<<-PQ.top();
  40.             PQ.pop();
  41.         }
  42.  
  43.         cout<<endl;
  44.     }
  45.     return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement