#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. Codeforces 372

    A (被装的袋鼠不可以装的袋鼠)贪心,排序,从n/2分成两部分. B 好一道前缀和的题目. C 标准算法不难想,m^2的算法见http://codeforces.com/blog/entry/9907 ...

  2. HDU-4738 Caocao's Bridges 边联通分量

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4738 题意:在有重边的无向图中,求权值最小的桥. 注意trick就好了,ans为0时输出1,总要有一个 ...

  3. 各个版本spring的jar包以及源码下载地址

    各个版本spring的jar包以及源码下载地址,目前最高版本到spring4.1.2,留存备用: http://maven.springframework.org/release/org/spring ...

  4. thymeleaf的url属性

    一.使用表达式形式:@{...} 例如: <a th:href="@{http://localhost:8080/gtvg/order/details}">view&l ...

  5. final static T

    /** * An empty table instance to share when the table is not inflated. */ static final Entry<?,?& ...

  6. Linux实战教学笔记08:Linux 文件的属性(下半部分)

    第八节 Linux 文件的属性(下半部分) 标签(空格分隔): Linux教学笔记 ---更多相关资料请点我查看 第1章 链接的概念 在linux系统中,链接可分为两种:一种为硬链接(Hard Lin ...

  7. 【三支火把】---CDS5516舵机调试以及自己的感想!

    我依然坚持,任何一次自己的心有感触都要及时的记录下来,这样你的努力才是真正的努力. 这两天一直在用STM32调试CDS5516舵机,其实很简单,但是却花了将近两天的时间,过程之曲折我就不说了,先总结一 ...

  8. c++出错记录

    错误1如下:  vector<vector<int>> m_vc;  error: '&' cannot appear in a constant-expression ...

  9. Javaweb监听器(2)

    属性监听器:ServletRequestAtttributeListener/HttpSeessionAttributeListener/ServletContextAttributeListener ...

  10. IIS支持其他类型下载

    路径:IIS--默认网站属性-->http 头-->MIME映射 -->文件类型 -->新类型