第一轮 M
来源:互联网 发布:php权限管理系统demo 编辑:程序博客网 时间:2024/04/29 14:55
Milliard Vasya's FunctionTime Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionVasya is the beginning mathematician. He decided to make an important contribution to the science and to become famous all over the world. But how can he do that if the most interesting facts such as Pythagor’s theorem are already proved? Correct! He is to think out something his own, original. So he thought out the Theory of Vasya’s Functions. Vasya’s Functions (VF) are rather simple: the value of the Nth VF in the point S is an amount of integers from 1 to N that have the sum of digits S. You seem to be great programmers, so Vasya gave you a task to find the milliard VF value (i.e. the VF with N = 10 9) because Vasya himself won’t cope with the task. Can you solve the problem?InputInteger S (1 ≤ S ≤ 81).OutputThe milliard VF value in the point S.Sample Inputinputoutput110/*************************************************************************> File Name: m.cpp> Author: yuan> Mail:> Created Time: 2014年11月10日 星期一 22时24分14秒 ************************************************************************/#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>#include<stdlib.h>#include<algorithm>#include<cmath>#define MAX 1000000000using namespace std;char str[15];//int ans[82];int main(){ /* int t=MAX; printf("%d\n",t); memset(ans,0,sizeof(ans)); for(int i=1;i<=MAX;i++) { memset(str,0,sizeof(str)); sprintf(str,"%d",i); int l=strlen(str); int sum=0; for(int j=0;j<l;j++) { sum+=str[j]-'0'; } ans[sum]++; } for(int i=1;i<=81;i++) { printf(",%d",ans[i]); }*/ int ans[82]={0,10,45,165,495,1287,3003,6435,12870,24310,43749,75501,125565,202005,315315,478731,708444,1023660,1446445,2001285,2714319,3612231,4720815,6063255,7658190,9517662,11645073,14033305,16663185,19502505,22505751,25614639,28759500,31861500,34835625,37594305,40051495,42126975,43750575,44865975,45433800,45433800,44865975,43750575,42126975,40051495,37594305,34835625,31861500,28759500,25614639,22505751,19502505,16663185,14033305,11645073,9517662,7658190,6063255,4720815,3612231,2714319,2001285,1446445,1023660,708444,478731,315315,202005,125565,75501,43749,24310,12870,6435,3003,1287,495,165,45,9,1}; int ll; while(~scanf("%d",&ll)){ printf("%d\n",ans[ll]); } return 0;}
0 0
- 第一轮 M
- 第一轮 A
- 第一轮 B
- 第一轮 C
- 第一轮 E
- 第一轮 F
- 第一轮 H
- 第一轮 I
- 第一轮 K
- 第一轮 L
- 第一轮 J
- 第一轮 D
- 考研数学第一轮复习
- 第一轮训练总结
- Panasas第一轮面试题
- Bootstrap3学习第一轮(入门)
- 记JSOI2015第一轮
- Zenefits 第一轮编程题
- POJ2151Check the difficulty of problems 概率DP
- 小马哥-- 中国移动定制版4G。 高仿oppo 4G版等机型拆机图 开机图 谨防假冒
- Ubuntu 使用 heirloom-mail 调用外部邮箱 SMTP 服务器发送邮件
- 使用同步适配器(sync adapter)传输数据
- solr
- 第一轮 M
- hibernate中的一级缓存和二级缓存
- And Then There Was One - POJ 3517 递推
- 拓扑排序-字典序
- HttpClient 下载一张图片
- 第一轮 J
- Charm Bracelet(poj3624)(01背包)
- Ant 整合Jenkins自动构建
- Linux及Arm-Linux程序开发笔记(零基础入门篇)