Codeforces 10C Digital Root 规律题
来源:互联网 发布:淘宝号安全风险 编辑:程序博客网 时间:2024/06/04 18:56
题目链接:点击打开链接
#include<stdio.h>#include<iostream>#include<string.h>#include<set>#include<vector>#include<map>#include<math.h>#include<string>#include<stdlib.h>#include<algorithm>using namespace std;#define N 1000005#define ll __int64ll 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;}/*21 231 2 3*/
0 0
- Codeforces 10C Digital Root 规律题
- CodeForces 10C. Digital Root
- codeforces 10C C. Digital Root(数论)
- CodeForces 10 C.Digital Root(数论)
- CF 10C Digital Root
- #10 C. Digital Root (数论)
- SGU 118. Digital Root 找规律+模拟
- CodeForces 471C 规律题
- [Codeforces] 355A - Vasya and Digital Root
- Codeforces 715A & 716C Plus and Square Root【数学规律】 (Codeforces Round #372 (Div. 2))
- CodeForces 42C Safe cracking 规律题
- codeforces#327-C.Median Smoothing-规律题
- codeforces#327->C.Median Smoothing(规律题 )
- Codeforces Round #372 (Div. 2) -- C. Plus and Square Root(找规律枚举)
- Digital Root
- digital root
- digital root
- codeforces 24C 找规律
- 用wkhtmltopdf生成highcharts图表不美观,需要设置相应参数
- SQL聚集索引与非聚集索引总结2
- 今日作息及食谱(6.25)
- Linux命令自己写 — ls
- LeetCode 66 Valid Number
- Codeforces 10C Digital Root 规律题
- 单向链表反转(java)
- Spring@Autowired注解与自动装配
- C++编程学习之LeetCode OJ
- 关于C++中创建匿名类的时的情况
- 锁相环的组成和工作原理
- LeetCode:Length of Last Word
- ubuntu下通过unixodbc和freetds连接数据库
- 广告贴