当前位置:网站首页>PAT B1091
PAT B1091
2022-06-25 19:55:00 【Madness makes freedom】
1091 N- Automorphic number (15 branch )
If a certain number K Times the square of N in the future , The last few digits of the result are equal to K, So call this number “N- Automorphic number ”. for example 3×922=25392, and 25392 The last two of them are just 92, therefore 92 It's a 3- Automorphic number .
This question asks you to write a program to judge whether a given number is about a certain N yes N- Automorphic number .
Input format :
Enter a positive integer in the first line M(≤20), The next line shows M One to be tested 、 No more than 1000 The positive integer .
Output format :
For each number that needs to be tested , If it is N- The automorphic number outputs the smallest in a row N and NK2 Value , Separated by a space ; Otherwise output No. Attention topic guarantee N<10.
sample input :
3
92 5 233
sample output :
3 25392
1 25
No#include <iostream>
using namespace std;
int main()
{
int m;
cin >> m;
int x,squ;
while(m--)
{
cin >> x;
squ=x*x;
int i;
for(i=1000;i>=1;i/=10)
{
if(x/i!=0)
{
i*=10;
break;
}
}
for(int n=1;n<10;++n)
{
int squ_n;
squ_n=squ*n;
if(squ_n%i==x)
{
cout << n << ' ' << squ_n << endl;
break;
}
else if(n==9)
cout << "No\n";
}
}
return 0;
}
边栏推荐
- PHP FPM, workman, spoole, golang simple performance test
- Number of wechat applet custom input boxes
- Force wechat page font size to be 100%
- Gbpnzd firm offer for 14 months, simulation for 19 months, test stable
- JS asynchronism (III. usage of generator and async/await)
- 一、HikariCP获取连接流程源码分析一
- PostgreSQL division considerations
- 1、 Hikaricp source code analysis of connection acquisition process I
- Tcp/ip test questions (I)
- 200 OK (from memory cache) and 200 OK (from disk cache)
猜你喜欢

Hdoj topic 2005 day

PostgreSQL user role permissions

Jsonp function encapsulation

Thymleaf template configuration analysis

Two types of attribute injection methods

Panda weekly -2022/02/18

What are Baidu collection skills? 2022 Baidu article collection skills

Elastic high-performance computing on the cloud supports the rapid development of the life science industry, reducing costs and increasing efficiency

Vulnhub range - correlation:2
Android Development Notes - Quick Start (from sqllite to room licentiousness) 2
随机推荐
Solidity date tool
Validation of TTF font by validator of laravel
Vulnhub range - the planes:venus
五、HikariCP源码分析之初始化分析二
MySQL transaction explanation
Solidity contract address to wallet, wallet address to contract
DataX script task development record
Connecting PHP to MySQL instances in the lamp environment of alicloud's liunx system
Tcp/ip test questions (V)
Uniapp waterfall flow, applet waterfall flow, very simple, suitable for the whole platform
Mysql database design suggestions
ECS 7-day practical training camp (Advanced route) -- day01 -- setting up FTP service based on ECS
3、 Hikaricp source code analysis of connection acquisition process III
Is it safe for tongdaxin to open an account?
Vulnhub range - correlation:2
Vulnhub range the planes: mercury
打新债证券开户安全吗
Verification code native JS canvas
Can GoogleSEO only do content without external chain? (e6zzseo)
New features of php7