当前位置:网站首页>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;
}
边栏推荐
- jvm-运行时数据区
- Spring cup eight school league
- JS general form submission 1-onsubmit
- 战略、战术(和 OKR)
- Golang — template
- Onmenusharetimeline custom shared content is invalid, and the title and icon are not displayed
- 解决MySql 1045 Access denied for user ‘root‘@‘localhost‘ (using password: YES)
- Use and design of Muduo buffer class
- jvm-对象生命周期
- Depth and breadth first traversal of tree (regardless of binary tree)
猜你喜欢
QT learning 17 dialog box and its types
Implementation of Muduo accept connection, disconnection and sending data
Go language web development series 25: Gin framework: using MD5 to verify the signature for the interface station
[email"/>
Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email
金属有机骨架MOFs装载非甾体类抗炎药物|ZIF-8包裹普鲁士蓝负载槲皮素(制备方法)
GoLand 2021.2 configure go (go1.17.6)
Common network state detection and analysis tools
Metal organic framework (MOFs) antitumor drug carrier | pcn-223 loaded with metronidazole | uio-66 loaded with ciprofloxacin hydrochloride(
Richview trvstyle liststyle list style (bullet number)
Vite project commissioning
随机推荐
[combinatorics] permutation and combination (examples of combinatorial number of multiple sets | three counting models | selection problem | combinatorial problem of multiple sets | nonnegative intege
simpleParallax. JS (create poor visual effects for website pictures)
Raft 协议
Use vscode to view hex or UTF-8 codes
Go language web development series 27: Gin framework: using gin swagger to implement interface documents
Golang - command line tool Cobra
Page generation QR code
Qt学习22 布局管理器(一)
Common mixins
Collection of mobile adaptation related articles
JVM runtime data area
Go language web development series 30: gin: grouping by version for routing
【吉林大学】考研初试复试资料分享
Record 405 questions about bank callback post request
QT learning 22 layout manager (I)
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
JS Part III
八大排序
关于回溯问题中的排列问题的思考(LeetCode46题与47题)
使用vscode查看Hex或UTF-8编码