题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4095

----------------------------------------------------------------------------------------------------------------------------------------------------------
欢迎光临天资小屋http://user.qzone.qq.com/593830943/main

----------------------------------------------------------------------------------------------------------------------------------------------------------

As Happy Camper Harry pulls into his favorite campground with his family, he notices the sign:

'Campground occupancy is limited to 10 days within any consecutive 20-day period.' Harry is just

starting a 28-day vacation. What is the maximum number of days he can occupy a campsite during

his vacation?

We state the problem in more general terms. Suppose that 1 < L < P < V are integers. Camp-

ground occupancy is limited to L days within any consecutive P-day period. Happy Camper Harry

is just starting a V -day vacation. What is the maximum number of days he can occupy a campsite

during his vacation?

Input

The input will contain data for a number of test cases. For each test case, there will be one line of data,

containing values of L, P and V , in that order. All input integers can be represented by signed 32-bit

integers. End of data will be signaled by a line containing three zeros, which will not be processed.

Output

There will be one line of output for each test case. It will display the case number and the number of

days Happy Camper Harry can occupy a campsite during his vacation. The format is illustrated by

the sample output.

Sample Input

5 8 20

5 8 17

0 0 0

Sample Output

Case 1: 14

Case 2: 11

代码例如以下:

#include<stdio.h>
#define ll long long
int main()
{
ll l,p,v;
ll ans,temp;
int cas=1;
while(scanf("%lld %lld %lld",&l,&p,&v)!=EOF)
{
if(l==0 && p==0 && v==0)
break;
temp=v%p;
if(temp>=l)
{
temp = l;
}
ans=(v/p)*l+temp; printf("Case %d: ",cas++);
printf("%lld\n",ans);
}
return 0;
}

UVALive 6084 Happy Camper(数学题)的更多相关文章

  1. Gym 101194H / UVALive 7904 - Great Cells - [数学题+快速幂][2016 EC-Final Problem H]

    题目链接: http://codeforces.com/gym/101194/attachments https://icpcarchive.ecs.baylor.edu/index.php?opti ...

  2. UVALive 5840 数学题

    DES:给出三种材料A,B,C每种的个数.然后组合AB,BC,AC的利润.问能获得的最大利润是多少. 开始一点思路都没有.然后发现可以枚举其中两种的个数.那么最后一种就确定了.还是感觉很机智. #in ...

  3. UVALive - 4108 SKYLINE[线段树]

    UVALive - 4108 SKYLINE Time Limit: 3000MS     64bit IO Format: %lld & %llu Submit Status uDebug ...

  4. UVALive - 3942 Remember the Word[树状数组]

    UVALive - 3942 Remember the Word A potentiometer, or potmeter for short, is an electronic device wit ...

  5. UVALive - 3942 Remember the Word[Trie DP]

    UVALive - 3942 Remember the Word Neal is very curious about combinatorial problems, and now here com ...

  6. ytu 2558: 游起来吧!超妹!(水题,趣味数学题)

    2558: 游起来吧!超妹! Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 7  Solved: 3[Submit][Status][Web Board ...

  7. sdut 2416:Fruit Ninja II(第三届山东省省赛原题,数学题)

    Fruit Ninja II Time Limit: 5000MS Memory limit: 65536K 题目描述 Have you ever played a popular game name ...

  8. 思维 UVALive 3708 Graveyard

    题目传送门 /* 题意:本来有n个雕塑,等间距的分布在圆周上,现在多了m个雕塑,问一共要移动多少距离: 思维题:认为一个雕塑不动,视为坐标0,其他点向最近的点移动,四舍五入判断,比例最后乘会10000 ...

  9. UVALive 6145 Version Controlled IDE(可持久化treap、rope)

    题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_ ...

随机推荐

  1. STM32 IIC双机通信—— HAL库硬件IIC版

    参考传送门 关于IIC的原理这里我就不多说了,网上有很多很好的解析,如果要看我个人对IIC的理解的话,可以点击查看,这里主要讲一下怎样利用STM32CubeMx实现IIC的通讯,经过个人实践,感觉HA ...

  2. Spring 7大功能模块的作用

    1.   Spring 7大功能模块的作用 1)   核心容器(Spring core) 核心容器提供Spring框架的基本功能.Spring以bean的方式组织和管理Java应用中的各个组件及其关系 ...

  3. php获取当前url地址的方法小结

    js 获取: top.location.href //顶级窗口的地址 this.location.href //当前窗口的地址 php获取当前url地址: #测试网址: http://localhos ...

  4. openssl之EVP系列之10---EVP_Sign系列函数介绍

    openssl之EVP系列之10---EVP_Sign系列函数介绍     ---依据openssl doc/crypto/EVP_SignInit.pod翻译     (作者:DragonKing, ...

  5. 使用malloc分别分配2KB的空间,然后用realloc调整为6KB的内存空间,打印指针地址

    #include<stdio.h> #include<stdlib.h> #include<string.h> #include<malloc.h> i ...

  6. TensorFlow高层次机器学习API (tf.contrib.learn)

    TensorFlow高层次机器学习API (tf.contrib.learn) 1.tf.contrib.learn.datasets.base.load_csv_with_header 加载csv格 ...

  7. ios问题bug收录——1

     **[2713:59682] *** Assertion failure in -[MBProgressHUD show:], /Users/lu/Desktop/****/Pods/MBProgr ...

  8. 微信重排版 URL

    http://qbview.url.cn/getResourceInfo?appid=62&url=https%3A%2F%2Fcodepen.io%2Fbenjamminf%2Ffull%2 ...

  9. Android 去掉TabLayout下的阴影,AppBarLayout下的阴影

    开始还以为是TabLayout在高版本系统上的特殊表现呢,没有在意,UI提出说感觉不好看就查了一下,原来是在TabLayout放在AppBarLayout里面才有这样的效果,只需要对AppBarLay ...

  10. 转js调优

    随着网络的发展,网速和机器速度的提高,越来越多的网站用到了丰富客户端技术.而现在Ajax则是最为流行的一种方式.javascript是一种解释型 语言,所以能无法达到和C/Java之类的水平,限制了它 ...