I am doing 1066A - Vova and Train and I am using Gvim. Here is my source code below.
Code
It always says 'terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc shell returned 3
Need help! Thanks in advance!
# | User | Rating |
---|---|---|
1 | jiangly | 3898 |
2 | tourist | 3840 |
3 | orzdevinwang | 3706 |
4 | ksun48 | 3691 |
5 | jqdai0815 | 3682 |
6 | ecnerwala | 3525 |
7 | gamegame | 3477 |
8 | Benq | 3468 |
9 | Ormlis | 3381 |
10 | maroonrk | 3379 |
# | User | Contrib. |
---|---|---|
1 | cry | 168 |
2 | -is-this-fft- | 165 |
3 | Dominater069 | 161 |
4 | Um_nik | 160 |
5 | atcoder_official | 159 |
6 | djm03178 | 157 |
7 | adamant | 153 |
8 | luogu_official | 151 |
9 | awoo | 149 |
10 | TheScrasse | 146 |
Need Help With Error
I am doing 1066A - Vova and Train and I am using Gvim. Here is my source code below.
using namespace std; using ll = long long;
int main() { ios::sync_with_stdio(0); cin.tie(0);
int t;
cin >> t;
while(t--) {
ll d, v, l, r;
cin >> d >> v >> l >> r;
vector<ll> a;
for(ll i = 1; i <= d / v; i++) {
a.pb(v * i);
}
ll sum = 0;
for(ll i = 0; i < a.size(); i++) {
if(a[i] < l || a[i] > r) {
sum++;
}
}
cout << sum << "\n";
}
}
It always says 'terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc shell returned 3
Need help! Thanks in advance!
Name |
---|