您的位置:首页 > 其它

Codeforces 884 Book Reading

2017-10-28 11:15 344 查看
题目地址

题意:告诉你n天的工作时间,每天的时间是86400秒,告诉你这本书要看m秒,问你多少天能看完。

思路:直接模拟,每天的看书时间就是86400-num[i]秒,然后直接算就好了。

#include <iostream>
#include <cstring>
#include <string>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdio>
#include <algorithm>
#define N 200010
#define LL __int64
#define inf 0x3f3f3f3f
#define lson l,mid,ans<<1
#define rson mid+1,r,ans<<1|1
#define getMid (l+r)>>1
#define movel ans<<1
#define mover ans<<1|1
using namespace std;
const LL mod = 1e9 + 7;
const double eps = 1e-9;
int times
, n, m;
int main() {
cin.sync_with_stdio(false);
while (cin >> n >> m) {
for (int i = 0; i < n; i++) {
cin >> times[i];
}
int days = 0;
while (m>0&&days<n) {
m -= (86400 - times[days]);
days++;
}
cout << days << endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: