题意:

找出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. 一个简单的IM系统(Demo附源码)-- ESFramework 4.0 快速上手(08)

    前面的文章已经介绍完了基于ESFramework/ESPlus进行二次开发的所有要点,现在,我们可以开始小试牛刀了. 本文将介绍使用ESFramework的Rapid引擎开发的两个最简单的Demo,E ...

  2. 使用rdesktop远程连接Windows桌面

    之前使用的是KDE下的krdc.该程序的Grab Keys功能存在bug,导致Alt+TAB大多数时候不能被捕捉,从而无法使用键盘切换窗口.不过,其全屏功能是正常的,在多显示器的情况下,全屏只在一个屏 ...

  3. LeetCode OJ 34. Search for a Range

    Given a sorted array of integers, find the starting and ending position of a given target value. You ...

  4. digitalocean纽约机房最先开通IPv6

    DigitalOcean是一家位于美国的云主机服务商,总部位于纽约,成立于2012年.DigitalOcean的服务器全部采用KVM架构,具体高性能处理能力,并且配备SSD固态硬盘,速度优异.每台设备 ...

  5. 分享到QQ空间、新浪微博、腾讯微博和人人网

    function shareys(type, url, title, img, content) { switch (type) { case "sina": url = &quo ...

  6. 洛谷-ISBN号码-简单字符串

    题目描述 Description 每一本正式出版的图书都有一个ISBN号码与之对应,ISBN码包括9位数字.1位识别码和3位分隔符,其规定格式如“x-xxx-xxxxx-x”,其中符号“-”就是分隔符 ...

  7. Wsyscheck(系统检测维护工具) v1.68.33绿色版

    软件名称:系统检测维护工具(Wsyscheck) v1.68.33绿色版软件类别:国产软件运行环境:windows软件语言:简体中文授权方式:免费版软件大小:1022 KB软件等级:整理时间:2011 ...

  8. stm32时钟配置总结

    stm32时钟配置时钟源: 1,HSE(高速外部时钟)即常见的外接8M晶振方案: 2,HSI(高速内部时钟) 即8M内部振荡时钟方案: 3,LSE(低速外部时钟)即常见的32.768Khz晶振方案: ...

  9. python 实现excel转化成json文件

    1.准备工作 python 2.7 安装 安装xlrd -- pip install xlrd 2. 直接上代码 import xlrd from collections import Ordered ...

  10. apicloud教程

    http://community.apicloud.com/bbs/forum.php?mod=viewthread&tid=15939