51Nod 2020 排序相减
来源:互联网 发布:js regexp 编辑:程序博客网 时间:2024/05/29 19:01
#include<iostream> #include<queue> #include<vector> #include<stack> #include<algorithm>#include<cmath> #include<set>#include<map>#include<cstdio>using namespace std;int getmax(int *a){int sum=0;for(int i=3;i>=0;i--){sum=sum*10+a[i];}return sum;}int getmin(int *a){int sum=0;for(int i=0;i<4;i++){sum=sum*10+a[i];}return sum;}int main(){int n;cin>>n;while(n--){int a,b;scanf("%d %d",&a,&b);while(b--){int num[10],cnt=0;while(a){num[cnt++]=a%10;a/=10;}sort(num,num+4);int maxn=getmax(num);int minn=getmin(num);a=maxn-minn;}printf("%d\n",a);}return 0;}
阅读全文
1 0
- 51Nod-2020-排序相减
- 51Nod 2020 排序相减
- 51nod 2020 排序相减
- 51Nod--1018排序
- 51nod 1018 排序
- 51nod-【1018 排序】
- 【51Nod】1018 排序
- 51Nod 1018 排序
- 51Nod--1018 排序
- 51Nod-1018-排序
- 51nod 1018 排序
- 51NOD-1018 排序
- 51Nod-1018 排序【排序】
- 51nod 1485字母排序
- 51Nod-1020-逆序排序
- 51Nod - 1097 思维 + 排序
- 51Nod-1485-字母排序
- 51Nod 1018 排序 STL
- 2017年12月10日训练笔记
- 树链剖分简介(BZOJ1036)(洛谷2590)
- 炮兵阵地 (状态dp)
- Leetcode | Repeated String Match
- python知识点(2)——python基础 流程控制
- 51Nod 2020 排序相减
- Spark中存在的各种2G限制
- java定时任务调度Timer
- TCP/IP理论基础
- JAVA NIO之简介
- js代理一个函数
- TensorFlowSharp入门使用C#编写TensorFlow人工智能应用
- Angular对标签的增删改查
- 你为什么总是学不会设计模式?