/**
[统计] hdu 4379 the more the better
数据都2 * 10^7了却只给4s的时间是要说明hdu服务器比较强大啊,好吧,O(n)的算法。
解题报告 from 人人hdoj
简单题,首先想到所有小于 L/2 的,统统可以放进来,
最后,按照题意,还可能可以放一个大于 L/2 的数进来,
当小于 L/2 的数里面的最大值加上这个大于 L/2 的数的和小于 L 时,
答案加一。最后要注意所有数都小于 L/2 的处理。O(n) 算法可过此题。
*/
#include <stdio.h>
#include <algorithm>
using namespace std;
int main()
{
__int64 low,hig;
__int64 n,l,a,b,m,hh;
while(scanf("%I64d%I64d%I64d%I64d%I64d",&n,&l,&a,&b,&m) == 5)
{
low = 0;
hig = 10000000000LL;
int res = 0;
hh = l / 2;
while(n--)
{
b = (b + a) % m;
if(b <=
[统计] hdu 4379 the more the better
最新推荐文章于 2018-05-11 17:58:51 发布