#include <stdio.h>
#include <math.h>
#include <vector> using namespace std; int main()
{
int i; int x,y,z;
char *p;
double w=;
int temp;
char ch; vector<int> vec1; vector<unsigned int> vec2; vector<int> vec3; scanf("%d",&i); for(x=;x<i;x++)
{
    scanf("%d",&temp);
  vec1.push_back(temp);
}
for(x=;x<i;x++)
{
for(y=;y<;y++)
{
if((pow(w,y)-)*>=vec1[x] && (pow(w,y-)-)*<=vec1[x])
break;
}
vec2.push_back(y);
} for(x=;x<i;x++)
{
vec3.push_back(vec1[x]-*(pow(w,y-)-)-1);
} for(x=;x<i;x++)
{
     //内存的管理问题
p = (char*)malloc(sizeof(char)*(vec2[x]+1));
memset(p,,vec2[x]+1); for(y=;y<vec2[x];y++)
{
if(vec3[x]&0x1==) p[y]=+'';
else p[y]=+''; vec3[x] = vec3[x]>>;
}
for(y=,z=vec2[x]-;y<vec2[x]/;y++,z--)
{
ch = p[y];
p[y]= p[z];
p[z]=ch;
}
printf("%s\n",p); }
}

c语言实现:4和7幸运数字的题的更多相关文章

  1. 2014.11.12模拟赛【美妙的数字】| vijos1904学姐的幸运数字

    美妙的数字(number.c/.cpp/.pas) 题目描述 黄巨大认为非负整数是美妙的,并且它的数值越小就越美妙.当然0是最美妙的啦. 现在他得到一串非负整数,对于每个数都可以选择先对它做二进制非运 ...

  2. BZOJ 1853 【Scoi2010】 幸运数字

    Description 在中国,很多人都把6和8视为是幸运数字!lxhgww也这样认 为,于是他定义自己的"幸运号码"是十进制表示中只包含数字6和8的那些号码,比如68,666,8 ...

  3. BZOJ 4568 幸运数字

    题目传送门 4568: [Scoi2016]幸运数字 Time Limit: 60 Sec Memory Limit: 256 MB Description A 国共有 n 座城市,这些城市由 n-1 ...

  4. BZOJ 1853: [Scoi2010]幸运数字

    1853: [Scoi2010]幸运数字 Time Limit: 2 Sec  Memory Limit: 64 MBSubmit: 2117  Solved: 779[Submit][Status] ...

  5. 【BZOJ-4568】幸运数字 树链剖分 + 线性基合并

    4568: [Scoi2016]幸运数字 Time Limit: 60 Sec  Memory Limit: 256 MBSubmit: 238  Solved: 113[Submit][Status ...

  6. 【BZOJ-1853&2393】幸运数字&Cirno的完美算数教室 容斥原理 + 爆搜 + 剪枝

    1853: [Scoi2010]幸运数字 Time Limit: 2 Sec  Memory Limit: 64 MBSubmit: 1817  Solved: 665[Submit][Status] ...

  7. BZOJ1853 [Scoi2010]幸运数字

    本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000作者博客:http://www.cnblogs.com/ljh2000-jump/转 ...

  8. 【bzoj1853】 Scoi2010—幸运数字

    http://www.lydsy.com/JudgeOnline/problem.php?id=1853 (题目链接) 今天考试考了容斥,结果空知道结论却不会写→_→ 题意 求区间中不含6,8两个数字 ...

  9. 幸运数字(number)

    幸运数字(number) Time Limit:1000ms   Memory Limit:64MB [题目描述] LYK最近运气很差,例如在NOIP初赛中仅仅考了90分,刚刚卡进复赛,于是它决定使用 ...

随机推荐

  1. Can’t find file mysql/host.frm

    安装Mysql后报错: InnoDB: Apply batch completed 141115 15:04:36 InnoDB: Started; log sequence number 0 442 ...

  2. CSS 去掉IE10中type=password中的眼睛图标

    在IE10中,input[type=password],如果我们输入内容后,内容会变成圆点,这与以前一样,但后面多了一个眼睛图标,我们鼠标移过去按下会出现输入内容.有时我们想去掉这功能.IE10允许我 ...

  3. Spring bean configuration inheritance

    In Spring, the inheritance is supported in bean configuration for a bean to share common values, pro ...

  4. 开发WebForm时遇到的问题

    在做一个小项目时,一个很长的页面,页面底部有一个contact us form 整个页面我没有使用MVC,而是使用ASP.NET WebForm(.aspx)来实现,实现功能后发现,当用户在页面底部输 ...

  5. 斯特灵数 (Stirling数)

    @维基百科 在组合数学,Stirling数可指两类数,都是由18世纪数学家James Stirling提出的. 第一类 s(4,2)=11 第一类Stirling数是有正负的,其绝对值是个元素的项目分 ...

  6. Light oj 1236 - Pairs Forming LCM (约数的状压思想)

    题目链接:http://lightoj.com/volume_showproblem.php?problem=1236 题意很好懂,就是让你求lcm(i , j)的i与j的对数. 可以先预处理1e7以 ...

  7. java 2 8 10 16

    An integer literal may be expressed in decimal (base 10), hexadecimal (base 16), octal (base 8), or ...

  8. XML操作:1.XML类(http://blog.csdn.net/happy09li/article/details/7460521)

    XML绑定TreeView private void XmlOperation_Load(object sender, EventArgs e) { path = AppDomain.CurrentD ...

  9. 方差分析(ANOVA)(转)

    转自:http://blog.sciencenet.cn/blog-116082-218338.html 方差分析(analysis of variance,ANOVA),即变量分析,是对多个样本平均 ...

  10. socket的shutdown与close

    shutdown原型 int shutdown(int socket, int how); socket 指定socket的文件描述符 how    指定shutdown的类型 SHUT_RD 禁止读 ...