Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- //https://codeforces.com/problemset/problem/535/B
- //https://atcoder.jp/contests/abc221/tasks/abc221_c
- //https://atcoder.jp/contests/abc198/tasks/abc198_d
- //https://codeforces.com/contest/1553/problem/C
- vector<string> res;
- int n = 10;
- void rec (int i,string s) {
- if (i == n) {
- res.push_back(s);
- return;
- }
- rec(i + 1,s + '0');
- rec(i + 1,s + '1');
- }
- int main () {
- ios::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- rec(0,"");
- vector<int> a = {2,10,3,3,7,3,2,1,22,33};
- //~ 1100000110
- //~ 2 + 10 + 1 + 22 = 35
- int sum = 35;
- for (string s : res) {
- int sum2 = 0;
- for (int i = 0; i < (int) s.size(); ++i) {
- if (s[i] == '1') {
- sum2 += a[i];
- }
- }
- if (sum2 == sum) {
- cout << s << '\n';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement