Advertisement
a53

no_pals

a53
Feb 21st, 2019
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3.  
  4. int putere_log(int x,int a)
  5. {
  6. int s=1;
  7. while(a)
  8. {
  9. if(a&1)
  10. s=1LL*s*x%666013;
  11. a/=2;
  12. x=1LL*x*x%666013;
  13. }
  14. return s;
  15. }
  16.  
  17. int main()
  18. {
  19. int n,x,y;
  20. ifstream f("no_pals.in");
  21. f>>n;
  22. f.close();
  23. ofstream g("no_pals.out");
  24. for(int i=1;i<=n;++i)
  25. {
  26. x=(1LL*9*putere_log(10,i-1))%666013;
  27. y=(1LL*9*putere_log(10,i/2-(i%2==0)))%666013;
  28. g<<(x-y+666013)%666013<<'\n';
  29. }
  30. g.close();
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement