1069. The Black Hole of Numbers
来源:互联网 发布:帆布背包 知乎 编辑:程序博客网 时间:2024/05/17 08:54
#include<cstdio>#include<cstdlib>#include<algorithm>using namespace std;bool cmp(char a,char b){ return a > b;}int main(){ int n,a,b,c; char s[4]; scanf("%d",&n); do{ for(int i = 3;i >= 0;i --){ s[i] = n%10 + '0'; n /= 10; } sort(s,s + 4); b = atoi(s); sort(s,s + 4,cmp); a = atoi(s); c = a - b; printf("%04d - %04d = %04d\n",a,b,c); n = c; }while(c != 6174 && c != 0); return 0;}
0 0
- 1069. The Black Hole of Numbers (20)
- 1069. The Black Hole of Numbers (20)
- 1069. The Black Hole of Numbers
- PAT 1069. The Black Hole of Numbers
- PAT 1069. The Black Hole of Numbers
- 1069. The Black Hole of Numbers (20)
- 1069. The Black Hole of Numbers
- 1069. The Black Hole of Numbers (20)
- 1069. The Black Hole of Numbers (20)
- 1069. The Black Hole of Numbers (20)
- 1069.The Black Hole of Numbers
- 1069. The Black Hole of Numbers (20)
- 1069. The Black Hole of Numbers (20)
- 1069. The Black Hole of Numbers
- 1069. The Black Hole of Numbers (20)
- 1069. The Black Hole of Numbers (20)
- 1069. The Black Hole of Numbers (20)
- 1069. The Black Hole of Numbers (20)
- CSS三列布局小记,走出HTML布局阴影
- 包和权限
- SQL{常用}基础知识到存储过程简单整理
- MySQL必知必会之1-4
- 抽象abstract
- 1069. The Black Hole of Numbers
- 第一章:介绍Solr
- uva - 11520 - Fill the Square(贪心、字典序)
- Linux下/proc目录简介
- 基于MFC的时钟绘制
- uva12105 - Bigger is Better 大数
- 2. 编译u-boot
- usaco training 4.1.2 Fence Rails 题解
- stagefright与opencore对比