fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <sstream>
  4. using namespace std;
  5.  
  6. int main() {
  7. int c;
  8. string s1, s2;
  9. stringstream ss;
  10. int max=0;
  11. for(int i=100; i<1000; i++)
  12. for(int j=100; j<1000; j++) {
  13. c=i*j;
  14. ss.clear();
  15. ss<<c;
  16. ss>>s1;
  17. s2=s1;
  18. reverse(s1.begin(), s1.end());
  19. if(s1==s2) {
  20. if(c>max)
  21. max=c;
  22. }
  23. }
  24. cout<<max;
  25. return 0;
  26. }
Success #stdin #stdout 0.08s 16064KB
stdin
Standard input is empty
stdout
906609