当前位置:网站首页>12892. 子数整数(OJ,入门)
12892. 子数整数(OJ,入门)
2022-06-10 09:53:00 【DXB2021】
给对于一个五位数 a1a2a3a4a5,可将其拆分为三个子数: sub1=a1a2a3 sub2=a2a3a4 sub3=a3a4a5 例如,五位数 20207 可以拆分成: sub1=202 sub2=020(=20) sub3=207 现在给定一个正整数 K,要求你编程求出 10000 到 30000 之间所有满 足下述条件的五位数,条件是这些五位数的三个子数 sub1,sub2,sub3 都可以被 K 整除
输入格式:
一个正整数 K
输出格式:
每一行为一个满足条件的五位数,要求从小到大输出。不得重复输出 或遗漏。如果无解,则输出“No”。
限制:
0<K<=100
样例 1 :
输入: 15
输出: 22555 25555 28555 30000
C语言:
#include <stdio.h>
int main()
{
int k,b=0;
scanf("%d",&k);
for(int i=10000;i<=30000;i++)
{
int sub1,sub2,sub3;
sub1=i/100;
sub2=(i%1000)/10;
sub3=i%100;
if((sub1%k==0)&&(sub2%k==0)&&(sub3%k==0))
{
b=1;
printf("%d\n",i);
}
}
if(b==0)
printf("No");
return 0;
}评测状态
答案错误 50
语言: C
用时: 0 ms 内存: 1088 kb 代码长度: 288
边栏推荐
猜你喜欢

力扣 1037. 有效的回旋镖

What should we pay attention to when developing, designing and building the reward task source code

Do you know all the wonderful functions of the vlookup function?

协程asyncio异步编程

ADB 日志抓取

HMM详细介绍+举例

Réflexions sur la conception de la gestion du réseau Unicom 5g

如何在微信小程序中优雅地发送异步请求?
![[Blue Bridge Cup training 100 questions] scratch apple is ripe blue bridge cup scratch competition special prediction programming question intensive training simulation exercise question 13](/img/e3/adf2708c6bd577bcaafa7418a5cd51.png)
[Blue Bridge Cup training 100 questions] scratch apple is ripe blue bridge cup scratch competition special prediction programming question intensive training simulation exercise question 13

【边缘检测】基于matlab八方向sobel图像边缘检测【含Matlab源码 1865期】
随机推荐
协程asyncio异步编程
R language uses lmperm package to apply to the replacement method (replacement test and permutation tests) of linear model, uses LM model to build polynomial regression model, and uses LMP function to
无心剑中译里尔克《秋日》
Mongodb publishes "queryable encryption" system
Mysql database (26): View
Use nsenter to enter netns to capture packets
【497. 非重叠矩形中的随机点】
axure添加下拉菜单联动
力扣 1037. 有效的回旋镖
Requirements and business model analysis - Requirements 17- requirements management
七、策略模式
SAP 云平台多目标应用 Multi-Target Application 的开发技术介绍
成都測試設備定制_單片機C語言之數據類型初步介紹
5G 联通网管设计思路
程序编译基本过程
装饰器模式
When the SQL file exported from the PowerDesigner physical data model is executed, an error occurs?
Uncaught TypeError: Cannot read properties of undefined (reading ‘colspan‘)
phpstrom 将项目上传码云
已经过去多长时间的方式显示时间