HALF<水题>
来源:互联网 发布:乐视1s移动数据开关 编辑:程序博客网 时间:2024/04/30 03:54
题意:
找出n/d=0.5的所有数。输入:test,x(代表n的位数,1<=x<=4).并且n和d的每一个位数不能有重复,也不能是0。输入:11输出:the form 1/2 = 0.5.the form 2/4 = 0.5.the form 3/6 = 0.5.the form 4/8 = 0.5.the form 6/12 = 0.5.the form 7/14 = 0.5.the form 8/16 = 0.5.the form 9/18 = 0.5.
#include<cstdio>#include<cmath>using namespace std;int main (){ int a[10]; int t;scanf("%d",&t); while(t--){ int n;scanf("%d",&n); int mi=pow(10,n-1); int ma=pow(10,n)-1; for(int k=mi;k<=ma;k++){ for(int i=0;i<10;i++) a[i]=0; int A=k; int B=2*A; while(A) a[A%10]++ , A/=10; while(B) a[B%10]++ , B/=10; int flag=1; for(int i=0;i<10;i++) if(a[0]||a[i]>1) flag=0; if(flag) printf("the form %d/%d = 0.5.\n",k,2*k); } } return 0;}
0 0
- HALF<水题>
- Half-Sync/Half-Async
- half life
- half view
- half-node
- Half Water and Half Fire
- STRHH - Half of the half
- mina中Half Sync/Half Async模式
- HDU1592-Half of and a Half
- WOJ1142-Half of and a Half
- Half or five tenths?
- Half Year at MSFT
- 半心半意 half-hearted
- 权宜之计 half-measure
- Finding Your Better Half
- bottom half执行
- well begun, Half done
- Half-space Hyperplane
- 1
- ACdream 1210 Chinese Girls' Amusement 大数+思维
- 关于字符串指针的一些问题及字符串的左旋转代码
- 文字无限无缝滚动效果——和派孔明
- 在Jenkins中使用Git托管项目的源码创建Build Job(托管在GitHub上面)
- HALF<水题>
- 算法--查找--散列表查找
- 静态成员函数和友元
- hdu 1102 Constructing Roads(最小生成树,prim)
- 旅游
- cvCreateVideoWriter 创建视频文件写入器 用法
- Spring对css、img、js等静态文件拦截的解决办法
- UML建模工具—UMlet使用总结
- Java(数据类型转换)