当前位置:网站首页>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");
}
}
}
结果:
边栏推荐
猜你喜欢

1091 N-自守数 (15 分)

无服务器+域名也能搭建个人博客?真的,而且很快

Tidb二进制集群搭建

Redis源码-String:Redis String命令、Redis String存储原理、Redis字符串三种编码类型、Redis String SDS源码解析、Redis String应用场景

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

【Pytorch】nn.PixelShuffle

Strongly recommend an easy-to-use API interface

1071 小赌怡情 (15 分)

A used in the study of EEG ultra scanning analysis process

TF中的条件语句;where()
随机推荐
结合均线分析k线图的基本知识
进制转换间的那点事
Unity游戏排行榜的制作与优化
博途PLC 1200/1500PLC ModbusTcp通信梯形图优化汇总(多服务器多从站轮询)
[Recommender System]: Overview of Collaborative Filtering and Content-Based Filtering
恒源云-Pycharm远程训练避坑指南
你是如何做好Unity项目性能优化的
How Unity handles C# under the hood
2022-08-10 Group 4 Self-cultivation class study notes (every day)
伦敦银规则有哪些?
软件测试主要做什么工作,难不难?
tf中矩阵乘法
Redis测试
Redis source code-String: Redis String command, Redis String storage principle, three encoding types of Redis string, Redis String SDS source code analysis, Redis String application scenarios
机器学习总结(二)
oracle19c does not support real-time synchronization parameters, do you guys have any good solutions?
prometheus学习5altermanager
2022-08-10 第四小组 修身课 学习笔记(every day)
MindManager2022全新正式免费思维导图更新
基于FPGA的FIR滤波器的实现(4)— 串行结构FIR滤波器的FPGA代码实现