Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- ifstream f("date.in");
- ofstream g("date.out");
- int main()
- {
- int a,b,c,d,e;
- int n1,n2,dif;//n1=abcbe,n2=edab,n=ebce
- n1=a*10000+b*1000+c*100+b*10+e;
- n2=e*1000+d*100+a*10+b;
- for (a=1;a<=9;a++)
- for (e=1;e<=9;e++)
- for (b=0;b<=9;b++)
- for (c=0;c<=9;c++)
- for (d=0;d<=9;d++)
- {
- n1=a*10000+b*1000+c*100+b*10+e;
- n2=e*1000+d*100+a*10+b;
- dif=e*1000+b*100+c*10+e;
- if (n1-n2==dif)
- cout<<n1<<"-"<<n2<<"="<<dif;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement