#include <iostream>
#include <algorithm>
using namespace std;bool cmp(int a,int b){ return a>b;
}
int main(){int n,a[4]={0},b,c,t;cin>>n;t=n;do{a[0]=t/1000;//千位 a[1]=t%1000/100;//百位 a[2]=t%1000%100/10;//十位 a[3]=t%10;//个位 sort(a,a+4,cmp);//从大到小 b=a[0]*1000 +a[1]*100+a[2]*10+a[3];sort(a,a+4); //从小到大 c=a[0]*1000 +a[1]*100+a[2]*10+a[3];t=b-c;//两个数的差 printf("%04d - %04d = %04d\n",b,c,t);}while(t!=6174&&t!=0000);return 0;
}
详细解决方案
1069 The Black Hole of Numbers (20 分)
热度:45 发布时间:2023-12-05 07:00:39.0
相关解决方案
- 简单有关问题,怎么把这个语句如a:link{color:black}放在ASPX页面中(就是在<HEAD></HEAD>之间的格式怎么写
- English MV:Mastur bate for life(do you remember 'wrong hole')解决思路
- English MV:Mastur bate for life(do you remember 'wrong hole'?)解决思路
- 求助ACM题目Persistent Numbers
- Android 在现阶段WebView打开页面,判断是否有"black"
- random for a series of random numbers?
- 在 beaglebone black 开机启动自各儿的QT程序
- English MV:Mastur bate for life(do you remember 'wrong hole')解决方法
- Line Numbers for RichText Control in C
- 七、排序与取数
- 标题5:MySQL-Consecutive Numbers
- proj4 coordinates must be finite numbers
- caioj 1069 动态规划入门(二维一边推2:顺序对齐)(最长公共子序列拓展总结)
- POJ 2325 Persistent Numbers .
- POJ 3252 Round Numbers 数位DP .
- codeforces 55d A.Beautiful numbers 数位DP -
- HDU 1058 Humble Numbers -
- HDU 1069 Monkey and Banana 完全背包+DP .
- UVA 11582 Colossal Fibonacci Numbers!
- 1069. 微博转发抽奖(20) PAT
- 题目1442:A sequence of numbers 九度OJ
- PAT甲级-1023 Have Fun with Numbers (20分)
- PAT乙级-1069 微博转发抽奖 (20分)
- 【贪心】AGC011 Increasing Numbers
- codejam-Round1A-2008-Numbers
- LeetCode 448. Find All Numbers Disappeared in an Array
- PAT - 甲级 - 1100. Mars Numbers (20)(字符串处理)
- NYOJ - 436 - sum of all integer numbers(注意a0)
- CF1521A Nastia and Nearly Good Numbers
- B. Ordinary Numbers