Tên đăng nhập Điểm ▾ Bài tập Giới thiệu
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1

dadas

16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701
letrungvinh2007 815
Lê Trung Vinh
1601 1
16701 1601 1
16701 1601 1

include <bits/stdc++.h>

using namespace std;
vector<int> A;
set<int> res;
int sum = 0;
int n;
void Try(int i,bool used[]){
if(i == n+1) return;
for(int j = 0;j<n;j++){ if(!used[j]){ used[j] = 1; sum+=A[j]; res.insert(sum); Try(i+1,used); sum-=A[j]; used[j] = 0; } } } int main() { cin>>n;
bool used[n];
memset(used,0,sizeof(used));
for(int i = 1;i<=n;i++){
int k;cin>>k;A.push_back(k);
}
Try(1,used);
cout<<res.size()<<endl;
for(int i:res) cout<<i<<" ";
}

16701
sadboizzz 2018
Ninh Quang Thắng
1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701
olp23psa02
PSA - Nguyễn Như Hùng
1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1

s=input()
s=s.split()
x=int(s[0])
n=int(s[1])
m=int(s[2])
t=((x*(n+1)-1)%(m(x-1)))//(x-1)
print(t)

16701 1601 1
16701 1601 1
16701 1601 1
16701
ICT24C10103
Lê Đức Chính
1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1

include <iostream>

include <vector>

using namespace std;

int main() {
int n, k;
cin >> n >> k;
vector<int> d(n);
for (int i = 0; i < n; i++) {
cin >> d[i];
}

vector<int> dp(k + 1, 0);
dp[0] = 1;

for (int i = 0; i <= k; i++) {
    if (dp[i] > 0) {
        for (int j = 0; j < n; j++) {
            if (i + d[j] <= k) {
                dp[i + d[j]] += dp[i];
            }
        }
    }
}

int result = 0;
for (int i = 0; i <= k; i++) {
    result += dp[i];
}

cout << result << endl;

return 0;

}

16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1

Newbie

16701 1601 1
16701 1601 1

n = int(input())
a = list(map(int,input().split()))
k = sum(a)
dp = [0]*(k+1)
dp[0] = 1
for i in a:
for j in range(k,i-1,-1):
if(dp[j-i] != 0):
dp[j] = 1
for i in range(k+1):
if(dp[i] != 0 and i != 0):
print(i,end = " ")

16701 1601 1
16701
DarkDraven 1115
Trương Hán Phong
1601 1
16701 1601 1
16701
LDKM
Lê Đào Khôi Minh
1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1

uwu heli mn~
minh la haron nee~

16701 1601 1
16701 1601 1
16701 1601 1
16701 1601 1

include <bits/stdc++.h>

using namespace std;

int n, q, a[100009], m;
long long bit[100009];

void update(int x, int y)
{
while (x <= n)
{
bit[x] += y;
x += (x & -x);
}
}

int get(int p)
{
long long res = 0;
while (p > 0)
{
res += bit[p];
p -= (p & -p);
}
return res;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);

cin >> n >> q;
for (int i = 1; i <= n; i++) {cin >> a[i]; update(i, a[i]);}
for (int i = 1; i <= n; i++)
{
    int u, v;
    cin >> m >> u >> v;
    if (m == 1) update(u, v);
    if (m == 2) cout << get(v) - get(u - 1) << '\n';
}

}