fork(34) download
  1. #include <bits/stdc++.h>
  2. int main() {
  3. int p = 0, q = 0;
  4. for (int i = 1; i <= 52; i++) {
  5. for (int j = 1; j <= 52; j++) {
  6. if (i == j) { continue; }
  7. for (int k = 1; k <= 52; k++) {
  8. if (k == i || k == j) { continue; }
  9. for (int t = 1; t <= 52; t++) {
  10. if (t == i || t == j || t == k) { continue; }
  11. for (int l = 1; l <= 52; l++) {
  12. if (l == t || l == k || l == i || l == j) { continue; }
  13. int res = !(i % 13)+!(j % 13)+!(k % 13)+!(t % 13)+!(l % 13);
  14. p += res;
  15. q++;
  16. }
  17. }
  18. }
  19. }
  20. }
  21. std::cout << "answer for 5 cards is "
  22. << p / std::__gcd(p,q) << "/"
  23. << q / std::__gcd(p,q) << std::endl;
  24. return 0;
  25. }
Success #stdin #stdout 0.79s 15232KB
stdin
Standard input is empty
stdout
answer for 5 cards is 5/13