YT新人之巅峰大决战03
2014-03-09 08:55
441 查看
Problem Description
Now give you two integers n m, you just tell me the m-th number after radix point in 1/n,for example n=4,the first numble after point is 2,the second is 5,and all 0 followed
Input
Each line of input will contain a pair of integers for n and m(1<=n<=10^7,1<=m<=10^5)
Output
For each line of input, your program should print a numble on a line,according to the above rules
Sample Input
4 2 5 7 123 123
#include<Iostream> using namespace std; int main() { int n,m,i,s,a,t; while(cin>>n>>m) { if(m==1) cout<<0<<endl; else {s=10; for(i=1;i<=m;i++) { t=s/n; s=s%n*10; } cout<<t<<endl; } } return 0; }
Sample Output
5 0 8
相关文章推荐
- YT新人之巅峰大决战03
- YT新人之巅峰大决战04
- YT新人之巅峰大决战04
- 任意长度的正小数的加法(YT新人之巅峰大决战05)
- 任意长度的正小数的加法(YT新人之巅峰大决战05)
- (03)oracle新人笔记------表的相关操作
- 协议森林03 IP接力赛 (IP, ARP, RIP和BGP协议)
- Ado.Net小练习03(省市联动)
- 20171011WindowsPrj08_03IAT Hook
- 线性规划与网络流24题——03最小路径覆盖问题
- 03-语言入门-03-奇偶数分离
- 03 vue-cli下开发注意点
- 设计模式学习笔记03
- 03-SSH server config
- HTTP 03 HTTP 报文
- 03-VTK基础概念(1)
- Struts2+Spring+Hibernate step by step 03 整合Spring之中的一个(在DAO层验证username和password)
- 03中国开源镜像站点汇总
- cocos2d-x初学笔记03:菜单Menu
- android *** Layout 03