当前位置:网站首页>Exercise 10-1 judge the three digits that meet the conditions
Exercise 10-1 judge the three digits that meet the conditions
2022-07-03 14:09:00 【ᯤ⁹ᴳ⁺ ·】
exercises 10-1 Judge the three digits that meet the conditions (15 branch )
This question requests to realize a function , Count the complete square number with the same two digits in the three digits in a given interval ( Such as 144、676) The number of .
Function interface definition :
int search( int n );
Parameters passed in int n Is a three digit positive integer ( Highest digit non 0). function search return [101, n] The number of all the numbers that satisfy the conditions in the interval .
Sample referee test procedure :
#include <stdio.h>
#include <math.h>
int search( int n );
int main()
{
int number;
scanf("%d",&number);
printf("count=%d\n",search(number));
return 0;
}
/* Your code will be embedded here */
sample input :
500
sample output :
count=6
int search( int n ){
int count=0,m,x,a,b,c;
for(m=11;m*m<=n;m++){
x=m*m;
a=x%10;
b=x/10%10;
c=x/100;
if(a==b||a==c||b==c){
count++;
}
}
return count;
}
边栏推荐
- 核酸修饰的金属有机框架药物载体|PCN-223金属有机骨架包载Ad金刚烷|ZIF-8包裹阿霉素(DOX)
- [ACNOI2022]猜数
- 1px problem of mobile terminal
- JVM family - overview, program counter day1-1
- Solve MySQL 1045 access denied for user 'root' @ 'localhost' (using password: yes)
- Solve the problem of dormitory router campus network sharing login
- How to delete an attribute or method of an object
- QT learning 20 standard dialog box in QT (middle)
- Toast UI editor (editor allows you to edit your markup document using text or WYSIWYG, with syntax highlighting, scrolling synchronization, real-time preview and chart functions.)
- Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email
猜你喜欢

可编程逻辑器件软件测试

Summary of common error reporting problems and positioning methods of thrift

jvm-类加载

JVM family - overview, program counter day1-1

QT learning 19 standard dialog box in QT (top)

Comprehensive case of MySQL data addition, deletion, modification and query

allegro,orcad, net alias,port,off-page connector之间的异同点和如何选取

Redis: operation command of string type data

Print. JS -- web page file printing

金属有机骨架MOFs装载非甾体类抗炎药物|ZIF-8包裹普鲁士蓝负载槲皮素(制备方法)
随机推荐
Qt学习24 布局管理器(三)
Current situation, analysis and prediction of information and innovation industry
Toast UI editor (editor allows you to edit your markup document using text or WYSIWYG, with syntax highlighting, scrolling synchronization, real-time preview and chart functions.)
可编程逻辑器件软件测试
Go language web development series 27: Gin framework: using gin swagger to implement interface documents
JVM family - overview, program counter day1-1
Qt学习19 Qt 中的标准对话框(上)
Go 1.16.4: manage third-party libraries with Mod
How to use lxml to judge whether the website announcement is updated
Implementation of Muduo accept connection, disconnection and sending data
Scroll detection, so that the content in the lower right corner is not displayed at the top of the page, but is displayed as the mouse slides
Interface for querying IP home
Redis:Redis的数据结构、key的操作命令
Using registered classes to realize specific type matching function template
1px problem of mobile terminal
Doxorubicin loaded on metal organic framework MIL-88 DOX | folic acid modified uio-66-nh2 doxorubicin loaded [email
How to delete an attribute or method of an object
JVM object lifecycle
Spring cup eight school league
Canvas utility library fabric JS user manual