Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C++ Compiler.
- Code, Compile, Run and Debug C++ program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <iostream>
- #include <cmath>
- using namespace std;
- using ll = long long;
- ll a,b;
- ll S(ll x){
- return (2*3 + 3 * (x - 1)) * x / 2;
- }
- bool f(ll N){
- ll R = N;
- while (R >= 100){
- R = 0;
- while (N>0){
- R += (N % 100);
- N /= 100;
- }
- N = R;
- }
- if (R % 11 == 0) return true;
- else return false;
- }
- int main()
- {
- ll cnt = 0;
- for (ll i = 1000; i <= 1500; ++i){
- if (f(i)){
- cnt++;
- }
- }
- cout<<"cnt = "<<cnt<<'\n';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement