Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
cpp permutations
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#include<cstdio> #include<algorithm> using namespace std; //ma, ch, en, pe, self, self, choose, choose int pm[]={1,2,3,4,5,6,7,8}; int main() { int r=0; int rr=0; do { if (pm[4]!=pm[5]-1)continue; if (pm[6]!=pm[7]-1)continue; if (pm[6]<5)continue; if (pm[0]==8)continue; if (pm[3]==1||pm[4]==1)continue; ++r; if (pm[4]==4)++rr; }while(next_permutation(pm, pm+8)); printf("%d %d\n", r,r-rr); }
g++
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 0.69 sec, absolute running time: 0.14 sec, cpu time: 0 sec, memory peak: 2 Mb, absolute service time: 1.16 sec
fork mode
|
history
|
discussion