【CODE[VS]】4109 TTY loves numbers (月赛round2)
来源:互联网 发布:淘宝每年收入排行榜 编辑:程序博客网 时间:2024/06/01 11:55
传送门:http://codevs.cn/problem/4109/
我们最终就是求一个前面全是1,后面都是0的数
我写的构造
0很明显是为2和5这两个约数服务的,所以要能约完这两个才行
前面的逐位叠加判定即可
【题解里有大神提出了一个BSGS的做法(我没认真看)】
#include<stdio.h>#include<algorithm>int n,tot2,tot5,tot0,tot1;int main(){ scanf("%d",&n); for (;(n&1)==0;n>>=1) tot2++; for (;n%5==0;n/=5) tot5++; tot0=std::max(tot2,tot5); for (int p=1%n;p;p=(p*10+1)%n) tot1++; for (int i=0;i<=tot1;i++) putchar('1'); for (int i=0;i<tot0;i++) putchar('0');}
0 0
- 【CODE[VS]】4109 TTY loves numbers (月赛round2)
- 【CODE[VS]】3943 数学奇才琪露诺 (月赛round1)
- Google Code Jam 2016 Round2
- ztr loves lucky numbers(二分,枚举)
- hdu ztr loves lucky numbers (暴搜)
- CODE【VS】2809 盗窃-月之眼
- DZY Loves Fibonacci Numbers
- Dylans loves numbers
- hdu_5676_ztr loves lucky numbers
- hdoj5676ztr loves lucky numbers
- SecretSum (code jam china round2 500分真题) (第二轮淘汰赛)
- 【Google Code Jam 2009 round2 problem D】Watering Plants (两圆交点求法详解)
- Google Code Jam Round2 A,B题解
- Google Code Jam 2009 Round2 A (脑洞题)
- Bestcoder #82 Div2 ztr loves lucky numbers(next_permutation)
- HDU 5756 ztr loves lucky numbers (dfs)
- hdoj ztr loves lucky numbers 5676 (dfs模拟)
- hdu 5676ztr loves lucky numbers(全排列函数)
- Effective C++ 读书笔记
- Android设计模式(二)- 续:WindowManager
- 【Coursera Machine Learning】 Week2 学习笔记
- 哈希(散列)表之开放定址法的C++类模板实现
- 论文查重 降重复度?
- 【CODE[VS]】4109 TTY loves numbers (月赛round2)
- response.setContentType()的参数说明 转载http://rubyq.iteye.com/blog/1408141
- 递归递推总结
- 刷题遇上的知识点
- 基于platform总线的mini2440的led设备驱动例子
- 使用sudo对用户进行权限管理
- 七种常见经典排序算法总结(C++实现)
- 【转载】Particle Filter Tutorial 粒子滤波:从推导到应用(全)
- ubuntu14.04(amd64)下安装wine