Last active
February 22, 2016 06:51
-
-
Save junpeitsuji/db6fa47878c39c0429e9 to your computer and use it in GitHub Desktop.
periaさんの最大素数大富豪素数探索プログラムにおける結果 9999888877776666555544443333222213131313131312121212111111101101010111199998888777766665555444433332222131313131313121212121111111011010101111 の「最大性」をチェックするコード. ただし、最大性において以下の仮定をおいている.(1) JOKERはすべて "13" をもちいる(すなわち、13は6枚使用) (2) 相手の手元カードは "A" のみ(すなわち、1は3枚使用) 参考:Periaさんのコード https://gist.github.com/peria/00e294247aa422…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <gmpxx.h> | |
#include <algorithm> | |
#include <functional> | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
int main() { | |
vector<string> cards; | |
cards.push_back("10"); | |
cards.push_back("1"); | |
cards.push_back("10"); | |
cards.push_back("10"); | |
cards.push_back("10"); | |
cards.push_back("11"); | |
cards.push_back("1"); | |
cards.push_back("1"); | |
string base = "9999888877776666555544443333222213131313131312121212111111"; | |
sort(cards.begin(), cards.end(), greater<string>()); | |
do { | |
string value; | |
for (int i=0; i<cards.size(); i++) | |
{ | |
value += cards[i]; | |
} | |
value = base + value; | |
cout << value; | |
int ret = mpz_probab_prime_p(mpz_class(value.c_str()).get_mpz_t(), 100); | |
if (ret) { | |
cout << " (*)"; | |
} | |
cout << endl; | |
} while(next_permutation(cards.begin(), cards.end(), greater<string>())); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment