Advertisement
Korotkodul

N6. Блок-схемы

Nov 23rd, 2021
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3. Online C++ Compiler.
  4. Code, Compile, Run and Debug C++ program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <iostream>
  10. #include <cmath>
  11. using namespace std;
  12. using ll = long long;
  13. ll a,b;
  14.  
  15. ll S(ll x){
  16. return (2*3 + 3 * (x - 1)) * x / 2;
  17. }
  18.  
  19.  
  20. bool f(ll N){
  21. ll R = N;
  22. while (R >= 100){
  23. R = 0;
  24. while (N>0){
  25. R += (N % 100);
  26. N /= 100;
  27. }
  28. N = R;
  29. }
  30. if (R % 11 == 0) return true;
  31. else return false;
  32. }
  33.  
  34.  
  35. int main()
  36. {
  37. ll cnt = 0;
  38. for (ll i = 1000; i <= 1500; ++i){
  39. if (f(i)){
  40. cnt++;
  41. }
  42. }
  43. cout<<"cnt = "<<cnt<<'\n';
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement