#include <iostream>
#include <iomanip>
int main()
{
int Numbers[31] = { 0 };
const int Max = 6;
for( int d1 = 0; d1 < Max; ++d1 )
{
for( int d2 = 0; d2 < Max; ++d2 )
{
for( int d3 = 0; d3 < Max; ++d3 )
{
for( int d4 = 0; d4 < Max; ++d4 )
{
for( int d5 = 0; d5 < Max; ++d5 )
{
for( int d6 = 0; d6 < Max; ++d6 )
{
++Numbers[d1+d2+d3+d4+d5+d6];
}
}
}
}
}
}
std::cout << "Number\tTimesRolled\tPercentage" << std::endl;
const int MaxCombinations = 46656;
for( int i = 0; i < 31; ++i )
{
std::cout << i + 6 << '\t' << Numbers[i] << '\t' <<
std::showpoint << std::setprecision(3) <<
(double)Numbers[i] / MaxCombinations * 100 << '%' << std::endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aW9tYW5pcD4KaW50IG1haW4oKQp7CglpbnQgTnVtYmVyc1szMV0gPSB7IDAgfTsKCWNvbnN0IGludCBNYXggPSA2OwoJCglmb3IoIGludCBkMSA9IDA7IGQxIDwgTWF4OyArK2QxICkKCXsKCQlmb3IoIGludCBkMiA9IDA7IGQyIDwgTWF4OyArK2QyICkKCQl7CgkJCWZvciggaW50IGQzID0gMDsgZDMgPCBNYXg7ICsrZDMgKQoJCQl7CgkJCQlmb3IoIGludCBkNCA9IDA7IGQ0IDwgTWF4OyArK2Q0ICkKCQkJCXsKCQkJCQlmb3IoIGludCBkNSA9IDA7IGQ1IDwgTWF4OyArK2Q1ICkKCQkJCQl7CgkJCQkJCWZvciggaW50IGQ2ID0gMDsgZDYgPCBNYXg7ICsrZDYgKQoJCQkJCQl7CgkJCQkJCQkrK051bWJlcnNbZDErZDIrZDMrZDQrZDUrZDZdOwoJCQkJCQl9CgkJCQkJfQoJCQkJfQoJCQl9CgkJfQoJfQoJCglzdGQ6OmNvdXQgPDwgIk51bWJlclx0VGltZXNSb2xsZWRcdFBlcmNlbnRhZ2UiIDw8IHN0ZDo6ZW5kbDsKCWNvbnN0IGludCBNYXhDb21iaW5hdGlvbnMgPSA0NjY1NjsKCWZvciggaW50IGkgPSAwOyBpIDwgMzE7ICsraSApCgl7CgkJc3RkOjpjb3V0IDw8IGkgKyA2IDw8ICdcdCcgPDwgTnVtYmVyc1tpXSA8PCAnXHQnIDw8CgkJc3RkOjpzaG93cG9pbnQgPDwgc3RkOjpzZXRwcmVjaXNpb24oMykgPDwKCQkoZG91YmxlKU51bWJlcnNbaV0gLyBNYXhDb21iaW5hdGlvbnMgKiAxMDAgPDwgJyUnIDw8IHN0ZDo6ZW5kbDsKCX0KCXJldHVybiAwOwp9