题目链接: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. 引入拦截器及swagger支持及解决redis无法初始化问题

    Springboot引入拦截器 自定义的拦截器类 Interceptor package cn.zytao.taosir.auth.config; import javax.annotation.Re ...

  2. js常用特效——选项卡效果

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  3. linux环境下删除包含特殊字符的文件或目录

    linux环境下删除包含特殊字符的文件或目录 ls -liUse find command as follows to delete the file if the file has inode nu ...

  4. [CSS3] Create Dynamic Styles with CSS Variables

    In this lesson we are going to use CSS variables to keep our application's colors consistent. This i ...

  5. Google翻译PDF文档

    Google翻译PDF文档 翻译软件虽多如牛毛,但有关整段/全文翻译,堪用的软件极少, 涉及专业技术的文献.胜任翻译工作的人力稀缺.少不了project师讴心沥血. 由于多是PDF格式.即使要翻译个概 ...

  6. c++ STL unique , unique_copy函数

    一.unique函数 类属性算法unique的作用是从输入序列中"删除"全部相邻的反复元素. 该算法删除相邻的反复元素.然后又一次排列输入范围内的元素,而且返回一个迭代器(容器的长 ...

  7. VS2008执行MFC程序,提示microsoft incremental linker已停止工作解决方法

    事实上这边是由于设置有问题.详细的解决方式例如以下: 第一步:点击项目->"你的文件"属性->配置属性->链接器->启用增量链接   将  是(/INCRE ...

  8. iOS 自己主动登录,登录过程中一直显示载入页

    iOS开发中 假设client做的人性化一点肯定会考虑自己主动登录 事实上原理非常easy,就是再首次登录成功之后将username和password存入userdefault 下次登录的时候推断us ...

  9. 2016 ICPC CAMP Recording

    等了好久终于等到今天 马上能和群巨们一起学习了 希望不要暴露我太弱的本质............ 北京不冷,就是风大~~~ 1.24 8点准时起床了,准备下楼吃早饭 (这个宾馆好多美美的空姐对面就是东 ...

  10. 山东理工oj--1912--IP地址(水题)

     IP地址 Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 2011年2月3日,国际互联网名称与数字地址分配机构(ICANN) ...