当前位置:网站首页>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");
}
}
}
结果:
边栏推荐
猜你喜欢
prometheus学习4Grafana监控mysql&blackbox了解
1091 N-Defensive Number (15 points)
When MySQL uses GROUP BY to group the query, the SELECT query field contains non-grouping fields
TF中的条件语句;where()
MySQL使用GROUP BY 分组查询时,SELECT 查询字段包含非分组字段
tf.cast(), reduce_min(), reduce_max()
测试用例很难?有手就行
opencv实现数据增强(图片+标签)平移,翻转,缩放,旋转
详述MIMIC 的ICU患者检测时间信息表(十六)
ROS 服务通信理论模型
随机推荐
oracle19c does not support real-time synchronization parameters, do you guys have any good solutions?
Douyin API interface
机器学习总结(二)
伦敦银规则有哪些?
详述 MIMIC护理人员信息表(十五)
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
Discourse's Close Topic and Reopen Topic
从何跟踪伦敦金最新行情走势?
1081 检查密码 (15 分)
软件测试基本流程有哪些?北京专业第三方软件检测机构安利
1101 How many times B is A (15 points)
Edge 提供了标签分组功能
一张图了解JVM八大原子操作
SQL sliding window
如何选择专业、安全、高性能的远程控制软件
2022-08-09 Group 4 Self-cultivation class study notes (every day)
How to choose professional, safe and high-performance remote control software
你是如何做好Unity项目性能优化的
1106 2019数列 (15 分)
Activity的四种状态