标签:style class blog c code java
1 #include<iostream> 2 using namespace std; 3 4 int main() { 5 bool isPalindromic (int num); 6 int res = 0; 7 8 for(int i = 100; i < 1000 ; i++) 9 for(int j = 100; j < 1000; j++) { 10 if( isPalindromic(i*j) && i*j > res) 11 res = i*j; 12 } 13 cout << res; 14 system("pause"); 15 return 0; 16 } 17 //判断回文 18 bool isPalindromic(int num) { 19 int rev_num = 0; 20 int m = num;//商 21 while(m != 0) { 22 rev_num = rev_num * 10 + m%10; 23 m = m/10; 24 } 25 if( rev_num == num) 26 return true; 27 else 28 return false; 29 }
ProjectEuler 004题,布布扣,bubuko.com
标签:style class blog c code java
原文地址:http://www.cnblogs.com/wanghui390/p/3749257.html