题意:

找出n/d=0.5的所有数。输入:test,x(代表n的位数,1<=x<=4).并且n和d的每一个位数不能有重复,也不能是0。
输入:
1
1
输出:
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;
}

HALF<水题>的更多相关文章

  1. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  2. ACM :漫漫上学路 -DP -水题

    CSU 1772 漫漫上学路 Time Limit: 1000MS   Memory Limit: 131072KB   64bit IO Format: %lld & %llu Submit ...

  3. ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)

    1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 154  Solved: 112[ ...

  4. [poj2247] Humble Numbers (DP水题)

    DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...

  5. gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,

    1195: 相信我这是水题 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 821  Solved: 219 Description GDUT中有个风云人 ...

  6. BZOJ 1303 CQOI2009 中位数图 水题

    1303: [CQOI2009]中位数图 Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 2340  Solved: 1464[Submit][Statu ...

  7. 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛 B - 大还是小? 字符串水题

    B - 大还是小? Time Limit:5000MS     Memory Limit:65535KB     64bit IO Format: Description 输入两个实数,判断第一个数大 ...

  8. ACM水题

    ACM小白...非常费劲儿的学习中,我觉得目前我能做出来的都可以划分在水题的范围中...不断做,不断总结,随时更新 POJ: 1004 Financial Management 求平均值 杭电OJ: ...

  9. CF451C Predict Outcome of the Game 水题

    Codeforces Round #258 (Div. 2) Predict Outcome of the Game C. Predict Outcome of the Game time limit ...

  10. CF451B Sort the Array 水题

    Codeforces Round #258 (Div. 2) Sort the Array B. Sort the Array time limit per test 1 second memory ...

随机推荐

  1. 浙大 pat 1024题解

    1024. Palindromic Number (25) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue A ...

  2. Zeppelin使用spark解释器

    Zeppelin为0.5.6 Zeppelin默认自带本地spark,可以不依赖任何集群,下载bin包,解压安装就可以使用. 使用其他的spark集群在yarn模式下. 配置: vi zeppelin ...

  3. CSS,height:auto和height:100%有什么区别?

    auto是随内容的高度而撑开的.100%是根据父级元素的高度来决定的.例如:<div style="height:100px;width:200px;"> <di ...

  4. 手动编译生成apk

    转载一篇介绍如何去手动编译生成apk的文章: http://jojol-zhou.iteye.com/blog/729254

  5. java类中为什么设置set和get方法操作属性

    java程序规范中会建议大家尽量将类中的属性私有化,即定义为private变量,通过设置set和get函数来对属性进行操作.一些人存在这样的疑问,为什么不直接将属性设置为public,以后调用属性时直 ...

  6. WebService使用入门(包括发布服务,调用服务)

    WebService是基于SOAP协议的,全称是Simple Object Access Protocol(简单对象访问协议). SOAP不是什么神奇的东西,等于HTTP+XML,即在HTTP协议的基 ...

  7. caogao

    https://css-tricks.com/ 在safari浏览器中添加transform规则,如果没有效果,把该规则的原始元素以块状显示 http://webdesignerwall.com/tr ...

  8. 欧几里得算法求最大公约数(gcd)

    关于欧几里得算法求最大公约数算法, 代码如下: int gcd( int a , int b ) { if( b == 0 ) return a ; else gcd( b , a % b ) ; } ...

  9. 移动UI

    UI设计需要关注:色彩,信息布局,交互流程,用户体验,尺寸等

  10. 《Java Mail》

    <Java Mail> 文/冯皓林 完稿:2016.3.16--2016.3.19 “特定环境.一类问题.N个解决方案” 一.RFC821文档说明 核心: 邮件(Mail): 1.邮件头( ...