usaco Fractions to Decimals
来源:互联网 发布:淘宝好评怎么删除评论 编辑:程序博客网 时间:2024/05/28 05:17
这是一道模拟题。
/*ID: guo geerPROG: fracdecLANG: C++*/#include<iostream>#include<cstdio>#include<cstring>#include<string>using namespace std;int note[300000];int f(int n){ int k=0; if(n==0) return 1; while(n) { n/=10; k++; } return k;}int main(){ freopen("fracdec.in","r",stdin); freopen("fracdec.out","w",stdout); int m,n; while(scanf("%d%d",&m,&n)==2) { if(m%n==0) { printf("%d.0\n",m/n); continue; } memset(note,0,sizeof(note)); int t=m%n; for(int i=0;;i++) { note[t]=1; t=(t*10)%n; if(note[t]==1)break; } int Count=f(m/n); printf("%d.",m/n); m=m%n; Count ++; int times = 0; for(int i=0;;i++) { if(m==t) { if(t==0) break; if(times == 0) { printf("("); Count++; if(Count%76==0) printf("\n"); } if(times == 1) { printf(")"); Count++; break; } times ++; } printf("%d",(m*10)/n); m=(m*10)%n; Count++; if(Count%76==0) printf("\n"); } printf("\n"); } return 0;}
- USACO Fractions to Decimals
- USACO Fractions to Decimals
- usaco Fractions to Decimals
- USACO:Fractions to Decimals
- USACO-Fractions to Decimals
- USACO-Fractions to Decimals
- 【模拟】【USACO】Fractions to Decimals
- USACO--2.4Fractions to Decimals
- USACO 2.4 Fractions to Decimals
- usaco——fractions to Decimals
- USACO :Fractions to Decimals解题报告
- 输入输出细节处理,USACO Fractions to Decimals
- USACO 2.4.5 Fractions to Decimals
- USACO Fractions to Decimals,有重大疑问
- USACO 2.4.5 Fractions to Decimals
- USACO Section 2.3 Fractions to Decimals
- USACO 2.4 Fractions to Decimals (fracdec)
- USACO 2.4 Fractions to Decimals (模拟)
- 编程这桶酒的正确喝法
- Android模拟器如何与本地电脑服务器连接
- sql 总结知识点
- oracle中left join中on和where的区别
- 【小郝推荐】《追逐App Store的脚步——手机软件开发者创富之路 》
- usaco Fractions to Decimals
- 哈,真的很久没登陆了
- Android SDK更新后提示This version of ADT requires the...your SDK to the latest version
- html float 原理 及案例解析
- 使用WZC函数在WINDOWS CE下搜索连接WIFI的具体实现与源码
- 谷歌应用支持查看返回数据类型
- SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEM...
- 从零开始学习攻心术——被99%的人忽略的十个心理细节
- 用m2eclipse创建Maven项目时报错