poj 2191

真恶心,真没想到最后是打表才能过。。。

//============================================================================
// Name        : 2191.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

//int n, num, tag;
//long long t, k;
//int a[100];
//int isprime(int m){
//	for(int i = 2;i <= sqrt(m);i++){
//		if(m%i == 0) return 0;
//	}
//	return 1;
//}
//
//
//int main() {
//	freopen("a.txt", "r", stdin);
//	for(int i = 2;i <= 63;i++){
//		if(isprime(i)){
//			a[++num] = i;
//		}
//	}
//	while(scanf("%d", &n)!=EOF){
//		for(int i = 1;a[i] <= n;i++){
//			tag = 0;
//			k = pow(2, a[i])-1;
//			t = k;
//			for(long long j = 2;j <= sqrt(k);j++){
//				while(t%j == 0){
//					tag = 1;
//					if(t != j) printf("%lld * ", j);
//					else printf("%lld", j);
//					t /= j;
//				}
//
//			}
//			if(tag == 1&&t!=1) printf("%lld", t);
//			if(tag == 1) printf(" = %lld = ( 2 ^ %d ) - 1\n", k, a[i]);
//		}
//	}
//	return 0;
//}


char s[9][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, t;


int main(){
	while(scanf("%d", &n)!=EOF){
		if(n < 11) t = 0;
		else if(n >= 11&&n < 23) t = 1;
		else if(n >= 23&&n < 29) t = 2;
		else if(n >= 29&&n < 37) t = 3;
		else if(n >= 37&&n < 41) t = 4;
		else if(n >= 41&&n < 43) t = 5;
		else if(n >= 43&&n < 47) t = 6;
		else if(n >= 47&&n < 53) t = 7;
		else if(n >= 53&&n < 59) t = 8;
		else if(n >= 59) t = 9;
		for(int i = 0;i < t;i++){
			printf("%s\n", s[i]);
		}
	}
	return 0;
}

  

posted @ 2011-07-24 18:24  KOKO's  阅读(222)  评论(0编辑  收藏  举报