1 solutions
-
0
C :
#include <stdio.h> int main() { int a,b,c; for(a=123;a<=333;a++) { b=a*2; c=a*3; if((a/100+a/10%10+a%10+b/100+b/10%10+b%10+c/100+c/10%10+c%10==1+2+3+4+5+6+7+8+9)&&((a/100)*(a/10%10)*(a%10)*(b/100)*(b/10%10)*(b%10)*(c/100)*(c/10%10)*(c%10)==(1)*(2)*(3)*(4)*(5)*(6)*(7)*(8)*(9))) printf("%d %d %d\n",a,b,c); } return 0; }
C++ :
#include<iostream> #include<algorithm> using namespace std; int main(){ bool f[10]; int a,b,c; for (a=123; a<=329; a++){ fill(f,f+10,0); b=2*a,c=3*a; f[a%10]=f[a/10%10]=f[a/100]=true; f[b%10]=f[b/10%10]=f[b/100]=true; f[c%10]=f[c/10%10]=f[c/100]=true; int cnt=0; for (int i=1; i<=9; i++) if (f[i]) cnt++; if (cnt==9) cout<<a<<" "<<b<<" "<<c<<endl; } return 0; }
- 1
Information
- ID
- 2268
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By