2797: 复仇者联盟之关灯

时间限制: 1 Sec  内存限制: 128 MB

提交: 563  解决: 160

题目描述

输入n(1~500)盏灯并编号,输入1~9(包含1和9)的数字m,灭掉编号中带m的数及m倍数的灯,最后输出亮出的灯的编号。

输入

灯数n,数字m

输出

剩下的亮的灯的编号(每个编号占一行)

样例输入

30 3

样例输出

1
2
4
5
7
8
10
11
14
16
17
19
20
22
25
26
28
29

你  离  开  了  ,  我  的  世  界  里  只  剩  下  雨  。  。  。

#include <stdio.h>
#include <stdlib.h>
int main()
{
int wei(int,int);
int a,b,i;
scanf("%d%d",&a,&b);
for(i=1; i<a; i++)
{
if(i%b==0||wei(i,b)==0)continue;
printf("%d\n",i);
}
return 0;
}
int wei(int a,int b)
{
while(a)
{
if(a%10==b)return 0;
a/=10;
}
return 1;
}

最新文章

  1. Redis配置文件redis.conf
  2. redis sentinel 配置
  3. winPcap_1_开篇
  4. BackgroundWorker 后台进程控制窗体label、richtextbook内容刷新
  5. Java数据类型(基本数据类型)学习
  6. !终端伪装测试之fuck校园网
  7. Spring Kafka和Spring Boot整合实现消息发送与消费简单案例
  8. 你觉得 .NET 性能低,可能只是因为你的能力低
  9. 加密算法之非对称加密RSA
  10. docker for windows 10 添加阿里云镜像仓库无效问题
  11. ibatis.net:尽可能的使用匿名类型替换 Hashtable
  12. python profile性能分析
  13. initctl 创建自己的JOB
  14. 垃圾收集简介 - GC参考手册
  15. 查看oracle 11g数据库用户的密码是否区分大小写
  16. vmware虚拟机下linux centos6.6只有lo,没有eth0网卡、随机分配ip地址,固定ip地址等问题
  17. Linux&amp;nbsp;2.6.32内核字符设备驱…
  18. oracle数据库单表查询
  19. 使用vsftp搭建ftp服务
  20. Tomcat 连接池调优

热门文章

  1. Python的伪造数据库:Faker
  2. webstom2017最新破解 ------------ http://blog.csdn.net/voke_/article/details/76418116
  3. docker在ubuntu16.04下的安装及阿里云镜像的配置
  4. 09C语言指针
  5. 51nod 1083 矩阵取数问题【动态规划】
  6. linux常用操作记录
  7. xfce 设在分辨率1920 1080
  8. Python随笔day02
  9. STM32F103移值FreeRtos笔记
  10. 【模板】51nod 1006 最长公共子序列Lcs