当前位置:网站首页>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;
}
边栏推荐
- Fabric. JS document
- Qt学习22 布局管理器(一)
- Metal organic framework MOFs loaded with non steroidal anti-inflammatory drugs | zif-8 wrapped Prussian blue loaded quercetin (preparation method)
- Nucleic acid modified metal organic framework drug carrier | pcn-223 metal organic framework encapsulated ad adamantane | zif-8 encapsulated adriamycin (DOX)
- Redis: operation command of string type data
- MySQL data processing value addition, deletion and modification
- UiO-66-COOH装载苯达莫司汀|羟基磷灰石( HA) 包裹MIL-53(Fe)纳米粒子|装载黄芩苷锰基金属有机骨架材料
- JS matrix zero
- Onmenusharetimeline custom shared content is invalid, and the title and icon are not displayed
- Reflection -- basic usage
猜你喜欢

如何使用lxml判断网站公告是否更新

Fabric. JS document
[email"/>Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email

Vite project commissioning

八大排序
[email protected] (FE) | glycyrrhetinic acid modified metal organ"/>Formation of mil-100 (FE) coated small molecule aspirin [email protected] (FE) | glycyrrhetinic acid modified metal organ

jvm-运行时数据区

JS first summary

Multi person collaborative data annotation based on Baidu brain easydata from scratch

QT learning 25 layout manager (4)
随机推荐
Generate directories from web content
JS Part 2
Leetcode-1175. Prime Arrangements
叶酸修饰的金属-有机骨架(ZIF-8)载黄芩苷|金属有机骨架复合磁性材料([email protected])|制备路线
Dlopen() implements dynamic loading of third-party libraries
Use and design of Muduo buffer class
Solve the problem of dormitory router campus network sharing login
Print. JS -- web page file printing
JS continues to explore...
Redis: operation command of string type data
QT learning 19 standard dialog box in QT (top)
1px problem of mobile terminal
Go language web development series 28: solve cross domain access of CORS with gin contrib / CORS
JVM垃圾回收机
page owner特性浅析
[ACNOI2022]猜数
玖逸云黑免费无加密版本源码
MySQL 数据增删改查综合案例
JS get DPI, PX to cm, cm to PX
QT learning 23 layout manager (II)