当前位置:网站首页>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");
}
}
}
结果:
边栏推荐
- Implement general-purpose, high-performance sorting and quicksort optimizations
- 公牛10-11德里克·罗斯最强赛季记录
- Daily sql-seek the sum of successful investments in 2016
- Go语言实现Etcd服务发现(Etcd & Service Discovery & Go)
- 2022-08-10 Group 4 Self-cultivation class study notes (every day)
- 微信小程序功能上新(2022.06.01~2022.08.04)
- Pinduoduo API interface (attach my available API)
- 关于Android Service服务的面试题
- 2022-08-09 第四小组 修身课 学习笔记(every day)
- go-grpc TSL认证 解决 transport: authentication handshake failed: x509 certificate relies on ... ...
猜你喜欢
Tidb二进制集群搭建
Redis测试
Pico neo3在Unity中的交互操作
Redis源码-String:Redis String命令、Redis String存储原理、Redis字符串三种编码类型、Redis String SDS源码解析、Redis String应用场景
STM32CUBEIDE(11)----输出PWM及修改PWM频率与占空比
如何选择专业、安全、高性能的远程控制软件
MindManager2022全新正式免费思维导图更新
unable to extend table xxx by 1024 in tablespace xxxx
Amazon API interface Daquan
MySQL使用GROUP BY 分组查询时,SELECT 查询字段包含非分组字段
随机推荐
Activity的四种启动模式
2022-08-09 第四小组 修身课 学习笔记(every day)
How Unity handles C# under the hood
Do not add the is prefix to the variables of the boolean type in the POJO class of the Alibaba specification
线程交替输出(你能想出几种方法)
exness:黄金1800关口遇阻,静待美国CPI出炉
Implementation of FIR filter based on FPGA (5) - FPGA code implementation of parallel structure FIR filter
网络电话软件或迎整顿 “免费”通话须迈安全关
Multiscale communication in cortical-cortical networks
Production and optimization of Unity game leaderboards
matplotlib
《猪猪1984》NFT 作品集将上线 The Sandbox 市场平台
【Pytorch】nn.Linear,nn.Conv
MindManager2022全新正式免费思维导图更新
Taobao product details API interface
Taobao API common interface and acquisition method
2022-08-10 第四小组 修身课 学习笔记(every day)
Douyin get douyin share password url API return value description
结合均线分析k线图的基本知识
break pad源码编译--参考大佬博客的总结