当前位置:网站首页>1148: combine one of three digits
1148: combine one of three digits
2022-04-21 09:10:00 【Qian Qian】
1148: Combine one of the three digits
Title Description
hold 1、2、3、4、5、6、7、8、9 Combine into 3 individual 3 digit , Each number is required to be used only once , Make each 3 The number of digits is a complete square number . Output these three three digits in descending order .
Input
nothing
Output
Output these three three digits in descending order , Separated by spaces . Output takes up one line .
source / classification
#include<stdio.h>
#include<string.h>
#define N 20
/* First find the three digit complete square number Then find out what is not repeated in turn */
// Judge whether there are duplicate numbers in two three digit numbers , No duplicate return 1
int Isrepeat(a,b){
if(b%10==a%10||b%10==a/10%10||b%10==a/100) return 0;
if(b/10%10==a%10||b/10%10==a/10%10||b/10%10==a/100) return 0;
if(b/100==a%10||b/100==a/10%10||b/100==a/100) return 0;
return 1;
}
int main(){
int a[N],x,y=0,i,j,k;
// Directly find the three digits that you don't repeat , Can narrow the scope (13-31)
for(i=13;i<32;i++){
x=i*i;
if((x%10!=x/100)&&(x/100!=x/10%10)&&(x%10!=x/10%10)) a[y++]=x;
}
// The three-level loop finds three non repeating three digits , And in order
for(i=0;i<y-2;i++){
for(j=i+1;j<y-1;j++){
for(k=j+1;k<y;k++){
if(Isrepeat(a[i],a[j])&&Isrepeat(a[j],a[k])&&Isrepeat(a[i],a[k]))
printf("%d %d %d\n",a[i],a[j],a[k]);
}
}
}
return 0;
}
版权声明
本文为[Qian Qian]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210906132269.html
边栏推荐
- [ctf.show.reverse] 逆向AK赛 EasyDSE
- Template adaptation guide for toudabi thesis
- Opencv -- separate color channel, image contrast, brightness adjustment, discrete Fourier transform (10)
- 原生与H5混合式开发详解
- 1168: 账单(指针专题)
- 基于asp.net网上鲜花购物管理
- L2-031 deep into the tiger's den (25 points)
- Penetration test - roaming from public cloud to intranet rce deserialization FRP
- Simulation implementation vector
- 2022 chemical automation control instrument examination exercises and simulation examination
猜你喜欢

笔记0104. MySQL 高级 - 索引 - 概述

C语言计数排序

CC00043.CloudJenkins—————————————
![[(strongly pushed) Li Hongyi 2021 / 2022 spring machine learning course] unsupervised learning - linear methods](/img/2a/de77caa5516ed34af52c14bbe8dbc7.png)
[(strongly pushed) Li Hongyi 2021 / 2022 spring machine learning course] unsupervised learning - linear methods

Convolution operation and cross correlation operation

Binary tree knowledge

Penetration practice - no echo rce thinkphp5 getshell

YApi基本使用(2022-04-15)

二叉树知识

LDO series -- PSRR
随机推荐
卷积运算与互相关运算
模拟实现vector
C语言计数排序
Open3d读写ply点云文件
[(strongly pushed) Li Hongyi 2021 / 2022 spring machine learning course] unsupervised learning - linear methods
BUUCTF[HCTF 2018]WarmUp
Redisson introduction and integration
Penetration practice - no echo rce thinkphp5 getshell
2022年流动式起重机司机考试练习题模拟考试平台操作
Controlled and uncontrolled components
Map Object WeakMap
2022年主要的编程语言及应用
My blog navigation directory (constantly sorting and updating...)
Flink的api入门案例
深蓝-视觉slam-第六节习题
[ctf.show.reverse] 逆向AK赛 EasyDSE
ue5 小知识点 动画蓝图接口 不能在editor中复制新的
Handler异步消息传递机制(一)Handler常用基本用法
方格分割【dfs】
Analyse de l'API d'interface de numéro personnel du robot Wechat PC