当前位置:网站首页>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");
}
}
}
结果:
边栏推荐
- 易观分析联合中小银行联盟发布海南数字经济指数,敬请期待!
- 【预约观看】Ambire 智能钱包 AMA 活动第四期即将举行
- TF中的One-hot
- Amazon Get AMAZON Product Details API Return Value Description
- CIKM 2022 AnalytiCup Competition: 联邦异质任务学习
- 语音信号处理:预处理【预加重、分帧、加窗】
- Redis源码:Redis源码怎么查看、Redis源码查看顺序、Redis外部数据结构到Redis内部数据结构查看源码顺序
- SQL sliding window
- Douyin share password url API tool
- 2022-08-10 第四小组 修身课 学习笔记(every day)
猜你喜欢

【预约观看】Ambire 智能钱包 AMA 活动第四期即将举行

unable to extend table xxx by 1024 in tablespace xxxx

go-grpc TSL认证 解决 transport: authentication handshake failed: x509 certificate relies on ... ...

基于FPGA的FIR滤波器的实现(5)— 并行结构FIR滤波器的FPGA代码实现

TF中的条件语句;where()

TF通过feature与label生成(特征,标签)集合,tf.data.Dataset.from_tensor_slices

1688 product interface

【Pytorch】nn.ReLU(inplace=True)

JD.com product details API call example explanation

Taobao API common interface and acquisition method
随机推荐
线程交替输出(你能想出几种方法)
【预约观看】Ambire 智能钱包 AMA 活动第四期即将举行
网络电话软件或迎整顿 “免费”通话须迈安全关
Daily sql-employee bonus filtering and answer rate ranking first
2022-08-10 Group 4 Self-cultivation class study notes (every day)
mysql视图与索引
daily sql - user retention rate for two days
【LaTex-错误和异常】\verb ended by end of line.原因是因为闭合边界符没有在\verb命令所属行中出现;\verb命令的正确和错误用法、verbatim环境的用法
从苹果、SpaceX等高科技企业的产品发布会看企业产品战略和敏捷开发的关系
ROS 服务通信理论模型
buu—Re(5)
Tf中的平方,多次方,开方计算
基于FPGA的FIR滤波器的实现(4)— 串行结构FIR滤波器的FPGA代码实现
maxwell concept
Redis源码:Redis源码怎么查看、Redis源码查看顺序、Redis外部数据结构到Redis内部数据结构查看源码顺序
Daily sql-seek the sum of successful investments in 2016
Do not add the is prefix to the variables of the boolean type in the POJO class of the Alibaba specification
Douyin API interface
Discourse's Close Topic and Reopen Topic
go-grpc TSL认证 解决 transport: authentication handshake failed: x509 certificate relies on ... ...