当前位置:网站首页>1096 big beautiful numbers (15 points)
1096 big beautiful numbers (15 points)
2022-08-11 07:48:00 【dumb bit】
题目要求:
代码:
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
//
for(int i = 0; i < n;i++) {
int num = scan.nextInt();
ArrayList<Integer> yinShu = new ArrayList<>();
//Find all factors that are not identical
for (int j = 1; j <= num; j++) {
if (num%j == 0 && !yinShu.contains(j)){
yinShu.add(j);
}
}
int size = yinShu.size();
//less than four directpass
if (size < 4){
System.out.println("No");
continue;
}
boolean flag = false;
//循环计算
for (int j = 0; j < size; j++) {
for (int k = j+1; k < size; k++) {
for (int l = k+1; l < size; l++) {
for (int m = l+1; m < size; m++) {
if ((yinShu.get(j) + yinShu.get(k) + yinShu.get(l) + yinShu.get(m))%num == 0){
flag = true;
break;
}
}
}
}
}
System.out.println(flag == true ? "Yes" : "No");
}
}
}
结果:
边栏推荐
- golang fork 进程的三种方式
- Redis source code-String: Redis String command, Redis String storage principle, three encoding types of Redis string, Redis String SDS source code analysis, Redis String application scenarios
- 【软件测试】(北京)字节跳动科技有限公司终面HR面试题
- 动态代理学习
- 1101 B是A的多少倍 (15 分)
- go-grpc TSL认证 解决 transport: authentication handshake failed: x509 certificate relies on ... ...
- 联想集团:2022/23财年第一季度业绩
- Tidb二进制集群搭建
- Unity3D 学习路线?
- 2021-08-11 for循环结合多线程异步查询并收集结果
猜你喜欢
随机推荐
When MySQL uses GROUP BY to group the query, the SELECT query field contains non-grouping fields
为什么C#中对MySQL不支持中文查询
There may be fields that cannot be serialized in the abnormal object of cdc and sqlserver. Is there anyone who can understand it? Help me to answer
ssh服务攻防与加固
PIXHAWK飞控使用RTK
CIKM 2022 AnalytiCup Competition: 联邦异质任务学习
MySQL使用GROUP BY 分组查询时,SELECT 查询字段包含非分组字段
opencv实现数据增强(图片+标签)平移,翻转,缩放,旋转
伦敦银规则有哪些?
How Unity programmers can improve their abilities
How Unity handles C# under the hood
maxwell concept
3.2-分类-Logistic回归
cdc连sqlserver异常对象可能有无法序列化的字段 有没有大佬看得懂的 帮忙解答一下
Tidb二进制集群搭建
如何选择专业、安全、高性能的远程控制软件
你是如何做好Unity项目性能优化的
How to choose professional, safe and high-performance remote control software
1046 punches (15 points)
Edge provides label grouping functionality