#include<bits/stdc++.h>
#define sf scanf
#define pf printf
#define LL long long
#define REP(i,MAX) for(LL i = 0; i<MAX; i++)
#define MAX 10000000+10
using namespace std;
int main()
{
char s[100];
while(cin >> s){
sort(s, s+strlen(s));
for (int i = 0; i < strlen(s); ++i)
{
if(s[i] != '0'){
swap(s[0],s[i]);
break;
}
}
long long a , b;
sscanf(s,"%lld",&b);
sort(s, s+strlen(s));
for (int i = 0 , j =strlen(s)-1; i < j; ++i,j--)
{
swap(s[i],s[j]);
}
sscanf(s,"%lld",&a);
cout<<a<<" - "<<b<<" = "<<a-b<<" = 9 * "<<(a-b)/9<<'\n';
}
return 0;
}
#define sf scanf
#define pf printf
#define LL long long
#define REP(i,MAX) for(LL i = 0; i<MAX; i++)
#define MAX 10000000+10
using namespace std;
int main()
{
char s[100];
while(cin >> s){
sort(s, s+strlen(s));
for (int i = 0; i < strlen(s); ++i)
{
if(s[i] != '0'){
swap(s[0],s[i]);
break;
}
}
long long a , b;
sscanf(s,"%lld",&b);
sort(s, s+strlen(s));
for (int i = 0 , j =strlen(s)-1; i < j; ++i,j--)
{
swap(s[i],s[j]);
}
sscanf(s,"%lld",&a);
cout<<a<<" - "<<b<<" = "<<a-b<<" = 9 * "<<(a-b)/9<<'\n';
}
return 0;
}
No comments:
Post a Comment