#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
long long count_tastiness(long long x,vector<long long>a){
long long y;
int cnt=0;
long long sum=0;
int i;
int k=a.size();
for(i=0;i<k;++i)
sum+=a[i]*(1LL<<i);
for(y=0;x*y<=sum;++y){
long long debt=0;
for(i=k-1;i>=0;--i){
if(y&(1LL<<i))
debt+=x*(1LL<<i);
debt-=a[i]*(1LL<<i);
if(debt<0)
debt=0;
}
if(debt==0)
++cnt;
}
return cnt;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |