QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#57710 | #2928. Espresso! | wtcherr# | WA | 2ms | 3708kb | C++20 | 2.2kb | 2022-10-22 17:56:05 | 2022-10-22 17:56:08 |
Judging History
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define IO ios_base::sync_with_stdio(0), cin.tie(0)
const int mod = 1e9 + 7;
template <typename T>
void readArray(vector<T> &A)
{
for (T &i : A)
cin >> i;
}
template <typename T>
void readArray(vector<vector<T>> &A)
{
for (vector<T> &i : A)
readArray(i);
}
template <typename T>
void printArray(vector<T> A)
{
for (T i : A)
cout << i << " ";
cout << endl;
}
ll fastPow(ll a, ll b, ll m = mod)
{
a %= m;
ll res = 1;
while (b > 0)
{
if (b & 1)
res = res * a % m;
a = a * a % m;
b >>= 1;
}
return res;
}
bool isPrime(ll n, int iter = 5)
{
if (n < 4)
return n == 2 || n == 3;
for (int i = 0; i < iter; i++)
{
int a = 2 + rand() % (n - 3);
if (fastPow(a, n - 1, n) != 1)
return false;
}
return true;
}
ll inv(ll n, ll m = mod)
{
return fastPow(n, m - 2);
}
ll mul(ll a, ll b, ll m = mod)
{
return (a * b) % m;
}
ll add(ll a, ll b, ll m = mod)
{
return (a + b + m) % m;
}
void solve()
{
int n, s;
cin >> n >> s;
int cur = s;
int cnt = 0;
for (int i = 0; i < n; i++)
{
string l;
cin >> l;
int need = l[0] - '0';
if (l.length() > 1)
need++;
if (cur >= need)
cur -= need;
else
{
cnt++;
cur = s;
}
}
cout << cnt;
}
void trials()
{
int t, tt;
for (cin >> t, tt = t; t--; cout << endl)
{
// cout << "Case #" << tt - t << ": ";
solve();
}
}
int main()
{
// freopen("","r",stdin);
IO;
solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3552kb
input:
1 10 4L
output:
0
result:
ok single line: '0'
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3708kb
input:
15 10 3 2L 3 1 3 2L 3 4 3L 2L 3 1 4 2 4L
output:
3
result:
wrong answer 1st lines differ - expected: '5', found: '3'