Untitled
unknown
plain_text
9 months ago
454 B
3
Indexable
int n, m, l, r;
ull t;
ull re = 0;
void nhap()
{
cin >> n >> m;
}
void solve()
{
nhap();
vii a(n);
FOR(i, 0, n) cin >> a[i];
while(m--)
{
cin >> t >> l >> r;
--l; --r;
re = t;
FORD(i, l, r)
{
if(re >= a[i])
{
ull k = re / a[i];
re -= k * a[i];
}
}
cout << re << el;
}
}Editor is loading...
Leave a Comment