牛客网PAT练兵场-数字黑洞
题解:循环即可
题目地址:https://www.nowcoder.com/questionTerminal/2e6a898974064e72ba09d05a60349c9e
/**
* Copyright(c)
* All rights reserved.
* Author : Ycute
* Date : 2019-10-31-16.37.32
* Description : 模拟输出
*/
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std; //降序
int cmp0(int a,int b){
return a>b;
}
//升序
bool cmp1(int a,int b){
return a<b;
}
int main(){
int in[];
int temp[];
int p;
scanf("%d",&p);
//scanf("%1d%1d%1d%1d",&in[0],&in[1],&in[2],&in[3]);
temp[]=in[]=p/;
temp[]=in[]=p/%;
temp[]=in[]=p%/;
temp[]=in[]=p%;
while(){
if(in[]==in[]&&in[]==in[]&&in[]==in[]){
printf("N - N = 0000\n");
break;
}
int t1[];
int t2[];
t1[]=temp[];
t1[]=temp[];
t1[]=temp[];
t1[]=temp[];
t2[]=temp[];
t2[]=temp[];
t2[]=temp[];
t2[]=temp[];
sort(t1,t1+,cmp0);
sort(t2,t2+,cmp1);
int num0=t1[]*+t1[]*+t1[]*+t1[];
int num1=t2[]*+t2[]*+t2[]*+t2[];
int num2=num0-num1;
temp[]=num2/;
temp[]=num2/%;
temp[]=num2%/;
temp[]=num2%;
printf("%d%d%d%d - %d%d%d%d = %d%d%d%d\n",t1[],t1[],t1[],t1[],t2[],t2[],t2[],t2[],temp[],temp[],temp[],temp[]);
if(temp[]==&&temp[]==&&temp[]==&&temp[]==) break ;
}
return ;
}
牛客网PAT练兵场-数字黑洞的更多相关文章
- 牛客网PAT练兵场-科学计数法
题目地址:https://www.nowcoder.com/pat/6/problem/4050 题解:模拟题 /** * Copyright(c) * All rights reserved. * ...
- 牛客网PAT练兵场-旧键盘打字
题目地址:https://www.nowcoder.com/pat/6/problem/4059 题解:用数组下标标记,直接模拟 /** * *作者:Ycute *时间:2019-12-01-21.3 ...
- 牛客网PAT练兵场-人口普查
题目地址:https://www.nowcoder.com/pat/6/problem/4054 题解:结构体排序即可 /** * Copyright(c) * All rights reserved ...
- 牛客网PAT练兵场-完美数列
题目地址:https://www.nowcoder.com/pat/6/problem/4056 题解:先将a数组进行排序,第一次按题意M<=n*p;n=a[0]时,M最大为J(如下图),然后n ...
- 牛客网PAT练兵场-打印沙漏
题目地址:https://www.nowcoder.com/pat/6/problem/4053 题意:模拟题 /** * Copyright(c) * All rights reserved. * ...
- 牛客网PAT练兵场-在霍格沃茨找零钱
题目地址:https://www.nowcoder.com/pat/6/problem/4063 题意:按照题目的进制计算即可 /** * *作者:Ycute *时间:2019-11-14-21.45 ...
- 牛客网PAT练兵场-福尔摩斯的约会
题目地址:https://www.nowcoder.com/pat/6/problem/4040 题意:模拟题,循环找相同的字母,但是注意题目的坑 /** * *作者:Ycute *时间:2019-1 ...
- 牛客网PAT练兵场-A除B
题目地址:https://www.nowcoder.com/pat/6/problem/4043 题解:遍历大数,边除边输出,最后得到余数输出即可 /** * *作者:Ycute *时间:2019-1 ...
- 牛客网PAT练习场-数字分类
签到题 地址:https://www.nowcoder.com/pat/6/problem/4078 #include<iostream> #include<cstdio> u ...
随机推荐
- SpringBoot之整合Quartz调度框架-基于Spring Boot2.0.2版本
1.项目基础 项目是基于Spring Boot2.x版本的 2.添加依赖 <!-- quartz依赖 --> <dependency> <groupId>org.s ...
- HTML <hr> 标签
高佣联盟 www.cgewang.com HTML <hr> 标签 实例 当内容的主题发生变化时,使用 <hr> 标签进行分隔: <h1>HTML</h1&g ...
- odoo12的视图常见属性和操作
1.菜单视图属性: 常用属性: name是展示在用户界面中的菜单项标题 action是点击菜单项时运行的窗口操作的XML ID parent是父级菜单项的XML ID.本例中父级项由其它模块创建,因此 ...
- Hive和HBase
1. 两者分别是什么? Apache Hive是一个构建在Hadoop基础设施之上的数据仓库.通过Hive可以使用HQL语言查询存放在HDFS上的数据.HQL是一种类SQL语言,这种语言最终被转化为M ...
- SSM三大框架的整合
好好学习,天天向上 本文已收录至我的Github仓库DayDayUP:github.com/RobodLee/DayDayUP,欢迎Star,更多文章请前往:目录导航 在Java后端开发领域,Spri ...
- 通过源代码分析Mybatis的功能
SQL解析 Mybatis在初始化的时候,会读取xml中的SQL,解析后会生成SqlSource对象,SqlSource对象分为两种. DynamicSqlSource,动态SQL,获取SQL(get ...
- .net core编写转发服务
我有个小伙伴问我,他需要写一个转发服务的他有很多功能要通过他的服务转发~ 技术栈又不一定asp.net core,我就想起泥水老前辈的BeetleX.FastHttpApi 中午午休,折腾了一会儿前辈 ...
- 【转载】requests库的7个主要方法、13个关键字参数以及响应对象的5种属性
Python爬虫常用模块:requests库的7个主要方法.13个关键字参数以及响应对象的5种属性 原文链接: https://zhuanlan.zhihu.com/p/67489739
- 虚拟机安装Centos(VirtulBox)
阿里云服务器本月底到期了,之前自己犹豫不觉没上279元3年服务器的车,但是又要用linux,所以有了这篇文章. VirtulBox 一款开源的虚拟化主机应用,可以实现一台电脑上运行多个操作系统(Lin ...
- Python环境搭建、python项目以docker镜像方式部署到Linux
Python环境搭建.python项目以docker镜像方式部署到Linux 本文的项目是用Python写的,记录了生成docker镜像,然后整个项目在Linux跑起来的过程: 原文链接:https: ...