HDU-4541-Ten Googol
来源:互联网 发布:淘宝买家怎么提升信誉 编辑:程序博客网 时间:2024/06/14 10:46
腾讯马拉松的一个题,开始觉得比较难,后来强行模拟做的,还好吧。
代码:
#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>using namespace std;int num[100]={4,3,3,5,4,4,3,5,5,4,3,6,6,8,8,7,7,9,8,8};int a[100][100],cnt[100];void Init(){ num[20]=num[30]=num[80]=num[90]=6; num[40]=num[50]=num[60]=5; num[70]=7; for(int i=20;i<=100;i++) {if(i%10==0) continue;num[i]=num[i-i%10]+num[i%10]; } for(int i=0;i<100;i++)a[num[i]][cnt[num[i]]++]=i; a[9][cnt[9]++]=101; a[9][cnt[9]++]=102; a[9][cnt[9]++]=103; a[9][cnt[9]++]=104; for(int i=0;i<100;i++)sort(a[i],a[i]+cnt[i]);}int main(){ int T,cas=1; Init(); scanf("%d",&T); while(T--) {int n,m;scanf("%d%d",&n,&m);if(cnt[n]<m) printf("Case #%d: -1\n",cas++);else if(n==9&&m>22){ if(a[9][m-1]==101)printf("Case #%d: 1",cas++); else if(a[9][m-1]==102)printf("Case #%d: 2",cas++); else if(a[9][m-1]==103)printf("Case #%d: 6",cas++); elseprintf("Case #%d: 10",cas++); for(int i=0;i<100;i++)printf("0"); printf("\n");}else printf("Case #%d: %d\n",cas++,a[n][m-1]); } return 0;}
- hdu 4541 Ten Googol
- HDU 4541 Ten Googol
- HDU-4541-Ten Googol
- hdu 4541 Ten Googol 小水题
- hdu 4541 Ten Googol (水题)
- Ten Googol
- HDU4541 Ten Googol
- HDU4541-Ten Googol(枚举)
- Googol
- ten
- ten
- Googol String
- HDU 2653 Waiting ten thousand years for Love
- HDU 2653 Waiting ten thousand years for Love
- HDU 2619 - Love you Ten thousand years (数论)
- HDU 2653Waiting ten thousand years for Love
- Google 和 Googol - 背景趣味
- Hdu 2579 Dating with girls(2) && hdu 2653 Waiting ten thousand years for Love【Bfs】
- 【tool】编码问题。。
- .NET设计模式(1): 简单工厂
- 20条编程经验
- Camera使用二(笔记)
- bat命令书写之空格问题
- HDU-4541-Ten Googol
- hadoop mapreduce 解决 top K问题
- Hibernate 参数设置一览表
- js的console.log用法
- oracle 10g 手动创建scott(tiger) schema
- Linux驱动总结3- unlocked_ioctl和堵塞(waitqueue)读写函数的实现
- insmod modprobe区别
- 让IE9以下的版本兼容HTML5解决方案
- 转载_vmware中的bridge、nat区别