当前位置:网站首页>PAT B1096
PAT B1096
2022-06-25 19:57:00 【Madness makes freedom】
1096 Great beauty number (15 branch )
If it's a positive integer N It can be divided by 4 The sum of two different positive factors , Such a positive integer is called “ Great beauty number ”. This question requires you to judge whether any given positive integer is “ Great beauty number ”.
Input format :
Enter a positive integer in the first line K(≤10), The next line shows K One to be tested 、 No more than 104 The positive integer .
Output format :
For each number that needs to be tested , If it is a large beautiful number, output it on one line Yes, Otherwise output No.
sample input :
3
18 29 40
sample output :
Yes
No
Yes#include <iostream>
#include <cstdio>
using namespace std;
struct factor
{
int fac[100];
};
int main()
{
int k;
scanf("%d",&k);
int n;
while(k--)
{
factor a;
scanf("%d",&n);
int j=0;
for(int i=1;i<=n/2;++i)
{
if(n%i==0)
a.fac[j++]=i;
}
a.fac[j++]=n;
int flag=0;
if(j<3) // The special judgment here is a little superfluous , Don't do this if Statement can also
{
printf("No\n");
continue;
}
for(int i=0;i<j&&!flag;++i)
for(int k=i+1;k<j&&!flag;++k)
for(int h=k+1;h<j&&!flag;++h)
for(int x=h+1;x<j&&!flag;++x)
{
int sum=a.fac[i]+a.fac[k]+a.fac[h]+a.fac[x];
if(sum%n==0&&flag==0)
{
printf("Yes\n");
flag=1;
}
}
if(flag==0)
printf("No\n");
}
return 0;
}
边栏推荐
- Alicloud centos8.0 installing mysql8
- 2、 Hikaricp source code analysis of connection acquisition process II
- Tcp/ip test questions (II)
- 2.14(Knight Moves)
- 在打新债开户证券安全吗?低佣金靠谱吗
- Server journey from scratch - Yu Zhongxian integrated version (IP access server, LNMP compilation and installation, Lua environment and socket expansion)
- Can GoogleSEO only do content without external chain? (e6zzseo)
- 打新债证券开户安全吗
- 六、HikariConfig的配置解析
- Verification code native JS canvas
猜你喜欢

Ali visual AI training camp -day03- construction of electronic photo album (face and expression recognition)

Arduino read temperature

Server journey from scratch - Yu Zhongxian integrated version (IP access server, LNMP compilation and installation, Lua environment and socket expansion)

The native JS mobile phone sends SMS cases. After clicking the button, the mobile phone number verification code is sent. The button needs to be disabled and re enabled after 60 seconds

PHP synchronizes website content to hundreds of websites to improve SEO ranking

LNMP compilation and installation

Vulnhub range - correlation:2

Wechat applet swiper simple local picture display appears large blank

Verification code native JS canvas

Applet multi image to Base64 upload
随机推荐
Network security detection and prevention test questions (V)
Applet Click to return to the top 2 methods
Using flex to implement the Holy Grail layout is as simple as that
Paddleocr learning (II) paddleocr detection model training
Applet multi image to Base64 upload
System optimization method
Uni app through uni Navigateto failed to pass parameter (pass object)
Simple native JS tab bar switching
Suddenly found that the screen adjustment button can not be used and the brightness can not be adjusted
Applet canvas generate sharing Poster
PHP little knowledge record
Applet wx Request encapsulation
PAT B1071
Mysql database design suggestions
Miner's Diary: why should I go mining on April 5, 2021
Is it safe to open an account with flush?
Electronic package to generate EXE file
Ali visual AI training camp -day03- construction of electronic photo album (face and expression recognition)
3、 Hikaricp source code analysis of connection acquisition process III
Validation of TTF font by validator of laravel