Từ CVT Online Judge, Trường Đại học Khoa học Tự nhiên - Đại học Quốc gia TP.HCM
Thông tin
lmao
ts/login/1 [email protected]
include <bits/stdc++.h>
using namespace std;
int main() { long long n, S; cin>>n>>S; long long a[n], f[S+1]; for (int i=1; i<=n; i++) cin>>a[i]; fill(f, f+S+1, 0); f[0]=1; for (int i=1; i<=n; i++) { for (int j=S; j>=0; j--) //f[j-a[i]]=1 why not if (j>=a[i] && f[j-a[i]]==1) { xf[j]=f[j-a[i]]; } }
for (int i=0; i<=S; i++) cout<<i<<" "<<f[i]<<endl;
//cout<<endl;
//for (int i=0; i<=S; i++) cout<<f[i]<<" ";
return 0;
} --sdsadsadsadsadsad////.asssas https://privnote.com/9sCMIF7K#yugh5WnL4 https://privnote.com/4YCir30c#b7u9elCXO
include <bits/stdc++.h>
define int long
using namespace std; const int N=1e6;
int n, a[N], counter=1;
signed main() { cin>>n; for (int i=1; i<=n; i++) cin>>a[i]; sort(a+1, a+n+1); a[n+1]=666; for (int i=1; i<=n; i++) { if (a[i]==a[i+1]) counter++; else { cout<<a[i]<<" "<<counter<<endl; counter=1; } } return 0; }</p>