当前位置:网站首页>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");
}
}
}
结果:
边栏推荐
- 【Pytorch】nn.Linear,nn.Conv
- radix-4 FFT principle and C language code implementation
- sql--Users who have purchased more than 3 times (inclusive) within 7 days (including the current day), and the purchase amount in the past 7 days exceeds 1,000
- Daily sql-statistics of the number of professionals (including the number of professionals is 0)
- jar服务导致cpu飙升问题-带解决方法
- Depth (relay supervision)
- linux 安装mysql服务报错
- 【深度学习】什么是互信息最大化?
- A used in the study of EEG ultra scanning analysis process
- prometheus学习5altermanager
猜你喜欢
Implementation of FIR filter based on FPGA (5) - FPGA code implementation of parallel structure FIR filter
【@网络工程师:用好这6款工具,让你的工作效率大翻倍!】
Redis源码:Redis源码怎么查看、Redis源码查看顺序、Redis外部数据结构到Redis内部数据结构查看源码顺序
Edge provides label grouping functionality
linux 安装mysql服务报错
Douyin share password url API tool
Amazon Get AMAZON Product Details API Return Value Description
Coordinate system in navigation and positioning
Redis测试
prometheus学习5altermanager
随机推荐
Daily SQL - find each of the students school gpa minimum (window)
Trill keyword search goods - API
【@网络工程师:用好这6款工具,让你的工作效率大翻倍!】
TF中的条件语句;where()
Attitude solution - gyroscope + Euler method
接口测试的基础流程和用例设计方法你知道吗?
DDR4内存条电路设计
下一代 无线局域网--强健性
Shell:三剑客之awk
Production and optimization of Unity game leaderboards
为什么我使用C#操作MySQL进行中文查询失败
Pico neo3在Unity中的交互操作
联想集团:2022/23财年第一季度业绩
TF中的One-hot
《猪猪1984》NFT 作品集将上线 The Sandbox 市场平台
TF通过feature与label生成(特征,标签)集合,tf.data.Dataset.from_tensor_slices
如何选择专业、安全、高性能的远程控制软件
MySQL 版本升级心得
tf中自减操作;tf.assign_sub()
Douyin API interface