当前位置:网站首页>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");
}
}
}
结果:
边栏推荐
- MySQL使用GROUP BY 分组查询时,SELECT 查询字段包含非分组字段
- Discourse 的关闭主题(Close Topic )和重新开放主题
- Internet phone software or consolidation of attack must be "free" calls security clearance
- Redis源码-String:Redis String命令、Redis String存储原理、Redis字符串三种编码类型、Redis String SDS源码解析、Redis String应用场景
- PIXHAWK飞控使用RTK
- Activity的四种启动模式
- Pytorch模型转ONNX模型
- maxwell concept
- Discourse's Close Topic and Reopen Topic
- Resolved EROR 1064 (42000): You have an error in. your SOL syntax. check the manual that corresponds to yo
猜你喜欢
随机推荐
SQL sliding window
redis操作
tf.cast(),reduce_min(),reduce_max()
2022-08-10 Group 4 Self-cultivation class study notes (every day)
1002 Write the number (20 points)
[Recommender System]: Overview of Collaborative Filtering and Content-Based Filtering
1056 组合数的和 (15 分)
Douyin API interface
1046 划拳 (15 分)
【软件测试】(北京)字节跳动科技有限公司终面HR面试题
Unity3D 学习路线?
接口测试的基础流程和用例设计方法你知道吗?
流式结构化数据计算语言的进化与新选择
go-grpc TSL认证 解决 transport: authentication handshake failed: x509 certificate relies on ... ...
Production and optimization of Unity game leaderboards
项目2-年收入判断
1076 Wifi密码 (15 分)
Discourse's Close Topic and Reopen Topic
How Unity programmers can improve their abilities
cdc连sqlserver异常对象可能有无法序列化的字段 有没有大佬看得懂的 帮忙解答一下