Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
#include
#include
#include
#include
using namespace std; typedef long long ll; const int maxn = 1e5 + 10; const ll INF = 1e16; int power(int a, int b) { int res = 1; for(int i = 0; i < b; i++) { res *= a; } return res; } int n, k; string to_binary(int x) { string res = ""; while(x > 0) { int rem = x % 2; res += rem + '0'; x /= 2; } while((int) res.size() < k) { res += "0"; } reverse(res.begin(), res.end()); return res; } int main() { cin >> n; cin >> k; vector
v(k); for(int i =0 ; i < k; i++) { cin >> v[i]; } int power_of_2 = power(2, k); for(int i = 0; i < power_of_2; i++) { string tmp = to_binary(i); vector
v_tmp; for(int j = 0; j < (int) tmp.size(); j++) { if(tmp[j] == '1') { v_tmp.push_back(v[j]); } } if((int) v_tmp.size() == n) { for(string s: v_tmp) { cout << s << " " ; } cout << endl; } } return 0; }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)