当前位置:网站首页>1096 大美数 (15 分)
1096 大美数 (15 分)
2022-08-11 06:45:00 【呆比特】
题目要求:
代码:
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<>();
//找出所有不相同的因数
for (int j = 1; j <= num; j++) {
if (num%j == 0 && !yinShu.contains(j)){
yinShu.add(j);
}
}
int size = yinShu.size();
//少于四个直接pass
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");
}
}
}
结果:
边栏推荐
- 6月各手机银行活跃用户较快增长,创半年新高
- Find the shops that have sold more than 1,000 yuan per day for more than 30 consecutive days in the past six months
- Tidb二进制集群搭建
- ROS 话题通信理论模型
- TF中的One-hot
- docker安装mysql5.7(仅供测试使用)
- Do not add the is prefix to the variables of the boolean type in the POJO class of the Alibaba specification
- JD.com product details API call example explanation
- daily sql - user retention rate for two days
- Implementation of FIR filter based on FPGA (5) - FPGA code implementation of parallel structure FIR filter
猜你喜欢
随机推荐
《猪猪1984》NFT 作品集将上线 The Sandbox 市场平台
Tidb二进制集群搭建
EasyPlayer针对H.265视频不自动播放设置下,loading状态无法消失的解决办法
Pinduoduo api interface application example
go-grpc TSL认证 解决 transport: authentication handshake failed: x509 certificate relies on ... ...
Daily sql-statistics of the number of professionals (including the number of professionals is 0)
Discourse's Close Topic and Reopen Topic
Attitude solution - gyroscope + Euler method
mysql视图与索引
Daily sql--statistics the total salary of employees in the past three months (excluding the latest month)
Daily sql - judgment + aggregation
Unity3D learning route?
Spatial Pyramid Pooling -Spatial Pyramid Pooling (including source code)
Discourse 的关闭主题(Close Topic )和重新开放主题
Tensorflow中使用tf.argmax返回张量沿指定维度最大值的索引
Taobao API common interface and acquisition method
TF中的One-hot
Coordinate system in navigation and positioning
Implementation of FIR filter based on FPGA (5) - FPGA code implementation of parallel structure FIR filter
NTT的Another Me技术助力创造歌舞伎演员中村狮童的数字孪生体,将在 “Cho Kabuki 2022 Powered by NTT”舞台剧中首次亮相