4問目。
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91*99.
Find the largest palindrome made from the product of two 3-digit numbers.
#include <iostream> using namespace std; int main() { int max=0; for(int i=100;i<=999;i++) { for(int n=100;n<=999;n++) { max=(i*1000)+(i/100)+((i/10%10)*10)+((i%10)*100); if((max % n)==0 && (max/ n) > 100 && (max/ n) < 1000) { cout<<n<<endl; cout<<max/n<<endl; cout<<max<<endl; break; } } }