Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int sumDigit(int n) {
- int sum=0;
- while(n>0) {
- sum+=(n%10);
- n/=10;
- }
- return sum;
- }
- int main()
- {
- int n,count[40] = {0},max=9,a,i,j,k,sum=0;
- cin >> n;
- if(n%2==1)
- cout<<0<<endl;
- else{
- a=n/2;
- for(i=1;i<a;i++)
- {
- max*=10;
- max+=9;
- }
- for (i=0;i<=max;i++)
- {
- ++count[sumDigit(i)];
- }
- for(i=0;i<=max;i++)
- {
- sum+=count[sumDigit(i)];
- }
- cout<<sum<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement