HALF<水题>
题意:
找出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<水题>的更多相关文章
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- ACM :漫漫上学路 -DP -水题
CSU 1772 漫漫上学路 Time Limit: 1000MS Memory Limit: 131072KB 64bit IO Format: %lld & %llu Submit ...
- ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)
1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 154 Solved: 112[ ...
- [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 ...
- gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,
1195: 相信我这是水题 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 821 Solved: 219 Description GDUT中有个风云人 ...
- BZOJ 1303 CQOI2009 中位数图 水题
1303: [CQOI2009]中位数图 Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 2340 Solved: 1464[Submit][Statu ...
- 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛 B - 大还是小? 字符串水题
B - 大还是小? Time Limit:5000MS Memory Limit:65535KB 64bit IO Format: Description 输入两个实数,判断第一个数大 ...
- ACM水题
ACM小白...非常费劲儿的学习中,我觉得目前我能做出来的都可以划分在水题的范围中...不断做,不断总结,随时更新 POJ: 1004 Financial Management 求平均值 杭电OJ: ...
- CF451C Predict Outcome of the Game 水题
Codeforces Round #258 (Div. 2) Predict Outcome of the Game C. Predict Outcome of the Game time limit ...
- CF451B Sort the Array 水题
Codeforces Round #258 (Div. 2) Sort the Array B. Sort the Array time limit per test 1 second memory ...
随机推荐
- Markdown 基础
How to use Markdown H1 text. H2 text. H3 text. H4 text. H5 text. H6 text. Text This is italic text. ...
- 转delphi中nil的用法
转自:http://blog.csdn.net/haiou327/article/details/6666124 delphi中nil的用法 和C++中的NULL一样的意思,指空值,它和0值不一样-- ...
- HDU 1863 Kruskal求最小生成树
好久没写博客了写着玩的…… Kruskal这种东西离散都学过…… 一句话…… 添加当前图权值最小且构不成环的一条边 直到连接所有点…… 其他人好多Kruskal的模版 肯定有比我的好的…… 就是刷一波 ...
- poj 1411 Calling Extraterrestrial Intelligence Again
题意:给你数m,a,b,假设有数p,q,满足p*q<=m同时a/b<=p/q<=1,求当p*q最大的p和q的值 方法:暴力枚举 -_-|| and 优化范围 我们可以注意到在某一个m ...
- NOIP2011-普及组复赛模拟试题-第一题-NBA总冠军
题目背景 Background 一年两度的期末考要到来了!! 题目描述 Description 又要到考试了,Ljw决定放松一下,就打开电视,看见了篮球赛,他立即想到了每年的NBA总冠军队伍.由 ...
- WinSnap屏幕截图 V4.5.6 官方最新版
软件名称: WinSnap屏幕截图软件语言: 多国语言授权方式: 免费试用运行环境: Win7 / Vista / Win2003 / WinXP 软件大小: 2.7MB图片预览: 软件简介:WinS ...
- javascript焦点图(根据图片下方的小框自动播放)
html和css就不详细说明了,也是简单布局,通过定位把跟随图片的小框,定位到图片下方 <!DOCTYPE html> <html> <head> <meta ...
- tomcat安装完设定用户名和密码
vi conf/tomcat-user.xml<tomcat-users> <role rolename="manager"/> <role role ...
- Openlayer 3 的画图测量面积
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- java 邮件
使用java语言实现邮件的简单的发送和接受. 说明:使用Java应用程序发送E-mail比较简单,在使用下列程序之前,你需要将mail.jar和activation.jar 添加到你的CLASSP ...