http:codeforces.comproblemsetproblem439A Devu, the Singer and Churu, the Joker

xiaoxiao2021-02-28  39

先判断休息时间加上歌唱时间是否超过活动时间,再尽量增多笑话的个数。

#include <iostream> #include <string> #include <cstdio> #include <algorithm> #include <vector> #include <stack> #include <queue> #define MAX 100005 #define mod 998244353ll #define INF 0x3f3f3f3f #define ll long long using namespace std; int main() { freopen("a.txt", "r", stdin); freopen("b.txt", "w", stdout); int n, d, a[105]; cin >> n >> d; int s = 0; for (int i = 1; i <= n; ++i) { scanf("%d", &a[i]); s += a[i]; } s += (n - 1) * 10; if (s <= d) { cout << (n - 1) * 2 + (d - s) / 5 << endl; } else { cout << -1 << endl; } return 0; }
转载请注明原文地址: https://www.6miu.com/read-2620050.html

最新回复(0)