探求心、それは意外な結果を導く鍵である。
■ このスレッドは過去ログ倉庫に格納されています
0077デフォルトの名無しさん
NGNG#include <vector>
#include <algorithm>
using namespace std;
int main()
{
const int mun_cards = 5;
vector<int> src; for(int c = 1; c <= mun_cards; c++) src.push_back(c);
cout << "<start>" << endl;
for(int skip = 1; skip < mun_cards; skip++) {
vector<int> card = src;
int total = 0, hit = 0;
do {
int i;
for(i = skip; i < mun_cards - 1; i++) {
for(int j = 0; j < skip; j++) {
if(card[j] >= card[i])
goto next;
}
break;
next:
continue;
}
if(card[i] == mun_cards)
hit++;
total++;
} while(next_permutation(card.begin(), card.end()));
cout << skip << ": " << hit << '/' << total << " (" << hit * 100.0 / total << "%)" << endl;
}
cout << "<end>" << endl;
return 0;
}
■ このスレッドは過去ログ倉庫に格納されています