设为首页 加入收藏

TOP

Codeforces 10C Digital Root 规律题
2015-07-24 05:53:31 来源: 作者: 【 】 浏览:4
Tags:Codeforces 10C Digital Root 规律

题目链接:点击打开链接


#include
  
   
#include
   
     #include
    
      #include
     
       #include
      
        #include
        #include
        
          #include
         
           #include
          
            #include
           
             using namespace std; #define N 1000005 #define ll __int64 ll num[10],n; ll go(ll x){ ll ans = x; while(ans>=10){ ans = 0; while(x) { ans += x%10; x /= 10; } x = ans; } return ans; } int main(){ ll i,j,k; while(~scanf("%I64d",&n)) { memset(num, 0, sizeof num); ll ans = 0; for(i=1;i<=n;i++) num[go(i)]++, ans -= n/i; for(j=0;j<10;j++) for(k=0;k<10;k++) ans+=num[k]*num[j]*num[go(k*j)]; printf("%I64d\n",ans); } return 0; } /* 2 1 2 3 1 2 3 */
           
          
         
        
      
     
    
   
  


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇ecos stm32 步步深入8 - 手工打造.. 下一篇freemarker写select组件报错总结..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: