当前位置:网站首页>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");
}
}
}
结果:
边栏推荐
- Douyin share password url API tool
- buu—Re(5)
- Daily sql-seek the sum of successful investments in 2016
- What are the things that should be planned from the beginning when developing a project with Unity?How to avoid a huge pit in the later stage?
- Daily sql: request for friend application pass rate
- Strongly recommend an easy-to-use API interface
- 常见激活函数及其导数
- 【LaTex-错误和异常】\verb ended by end of line.原因是因为闭合边界符没有在\verb命令所属行中出现;\verb命令的正确和错误用法、verbatim环境的用法
- 【Pytorch】nn.PixelShuffle
- 深度监督(中继监督)
猜你喜欢
随机推荐
易观分析联合中小银行联盟发布海南数字经济指数,敬请期待!
Pico neo3在Unity中的交互操作
Unity程序员如何提升自己的能力
Pinduoduo API interface (attach my available API)
Daily sql: request for friend application pass rate
求职简历这样写,轻松搞定面试官
redis操作
详述 MIMIC护理人员信息表(十五)
囍楽云任务源码
Amazon Get AMAZON Product Details API Return Value Description
NTT的Another Me技术助力创造歌舞伎演员中村狮童的数字孪生体,将在 “Cho Kabuki 2022 Powered by NTT”舞台剧中首次亮相
关于Android Service服务的面试题
【深度学习】什么是互信息最大化?
linux 安装mysql服务报错
SQL滑动窗口
prometheus学习5altermanager
Service的两种启动方式与区别
Unity底层是如何处理C#的
2022-08-10 Group 4 Self-cultivation class study notes (every day)
6月各手机银行活跃用户较快增长,创半年新高









