当前位置:网站首页>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;
}
边栏推荐
- PHP Chinese regular
- Dependency injection in PHP reflection implementation framework
- PAT B1081
- Electronic package to generate EXE file
- Ali vision AI training camp-day01
- Redis cache preheating & avalanche & breakdown & penetration
- Hdoj topic 2005 day
- The meanings of /32, /48, /64 in IPv6 addresses
- 二、HikariCP獲取連接流程源碼分析二
- Native JS array some method de duplication
猜你喜欢

One night I worked as an XPath Terminator: XPath Helper Plus

Suddenly found that the screen adjustment button can not be used and the brightness can not be adjusted

2.14(Knight Moves)

Print 1 cute every 100 milliseconds ~ with a running lantern effect

ECS 7-day practical training camp (Advanced route) -- day04 -- build a portal using ECs and polardb

2020-12-09 laravel . Env file loading mechanism process

200 OK (from memory cache) and 200 OK (from disk cache)

Jsonp function encapsulation

Yaml configuration

Hdoj topic 2005 day
随机推荐
2.17(Avoid The Lakes)
Ali visual AI training camp -day05- creativity day - your image recognition project
PostgreSQL change table owner
Arduino read temperature
ECS 7-day practical training camp (Advanced route) -- day01 -- setting up FTP service based on ECS
Vulnhub range - darkhole 1
Tcp/ip test questions (4)
Tcp/ip test questions (II)
2.16([Usaco2005 Nov]Ant Counting)
Android Development Notes - Quick Start (from sqllite to room licentiousness) 2
PAT B1091
PAT B1071
Some pictures of real machine preview development and debugging are not shown
JS mobile phone and computer open different websites
What should I pay attention to in GoogleSEO content station optimization?
Network security detection and prevention test questions (V)
Applet multi image to Base64 upload
On Oracle full stack virtual machine -- graalvm
请问通达信开户安全吗?
wooyun-2014-065513