当前位置:网站首页>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;
}
边栏推荐
- Message subscription and publishing
- QT learning 19 standard dialog box in QT (top)
- Go language unit test 5: go language uses go sqlmock and Gorm to do database query mock
- MIL-100( Fe) 包裹小分子阿司匹林形成[email protected](Fe)|甘草次酸修饰金属有机框架材料UiO-66-NH2(简称UiO-66-NH2-GA)
- 怎样删除对象的某个属性或⽅法
- JS shift operators (< <,> > and > > >)
- Invalid Z-index problem
- Thrift threadmanager and three monitors
- Generate directories from web content
- Print. JS -- web page file printing
猜你喜欢
Interface for querying IP home
Qt学习21 Qt 中的标准对话框(下)
GoLand 2021.1.1: configure the multi line display of the tab of the open file
Multi person collaborative data annotation based on Baidu brain easydata from scratch
28:第三章:开发通行证服务:11:在配置文件中定义属性,然后在代码中去获取;
核酸修饰的金属有机框架药物载体|PCN-223金属有机骨架包载Ad金刚烷|ZIF-8包裹阿霉素(DOX)
Solution to failure or slow downloading of electron when electron uses electron builder to package
Vite project commissioning
Qt学习17 对话框及其类型
全局事件总线
随机推荐
Redis: redis data structure and key operation commands
[acnoi2022] guess numbers
Too many files with unapproved license
Example analysis of QT learning 18 login dialog box
Current situation, analysis and prediction of information and innovation industry
Similarities and differences of sessionstorage, localstorage and cookies
可编程逻辑器件软件测试
Page generation QR code
QT learning 19 standard dialog box in QT (top)
JS input number and standard digit number are compared. The problem of adding 0 to 0
The small project (servlet+jsp+mysql+el+jstl) completes a servlet with login function, with the operation of adding, deleting, modifying and querying. Realize login authentication, prevent illegal log
GoLand 2021.1.1: configure the multi line display of the tab of the open file
JS get DPI, PX to cm, cm to PX
Qt学习20 Qt 中的标准对话框(中)
Go 1.16.4: purpose of go mod tidy
JS first summary
八大排序
Installation impression notes
Why don't I have a rookie medal
Qt学习19 Qt 中的标准对话框(上)