码迷,mamicode.com
首页 > 其他好文 > 详细

POJ 2191

时间:2014-08-28 16:05:29      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:blog   os   io   ar   for   div   log   amp   sp   

只会打表

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

int main()
{
int Mec[10] =
    { 11, 23, 29, 37, 41, 43, 47, 53, 59 };
    char st[10][100] =
    { "23 * 89 = 2047 = ( 2 ^ 11 ) - 1",
            "47 * 178481 = 8388607 = ( 2 ^ 23 ) - 1",
            "233 * 1103 * 2089 = 536870911 = ( 2 ^ 29 ) - 1",
            "223 * 616318177 = 137438953471 = ( 2 ^ 37 ) - 1",
            "13367 * 164511353 = 2199023255551 = ( 2 ^ 41 ) - 1",
            "431 * 9719 * 2099863 = 8796093022207 = ( 2 ^ 43 ) - 1",
            "2351 * 4513 * 13264529 = 140737488355327 = ( 2 ^ 47 ) - 1",
            "6361 * 69431 * 20394401 = 9007199254740991 = ( 2 ^ 53 ) - 1",
            "179951 * 3203431780337 = 576460752303423487 = ( 2 ^ 59 ) - 1" };
    int n;
    scanf("%d", &n);
    for (int i =0; i <9; i++)
        if (Mec[i] <= n)
            printf("%s\n", st[i]);

    return 0;
}

  

POJ 2191

标签:blog   os   io   ar   for   div   log   amp   sp   

原文地址:http://www.cnblogs.com/jie-dcai/p/3941733.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!