题目链接: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. centos7下部署FastDFS分布式文件系统

    前言 项目中用到文件服务器,有朋友推荐用FastDFS,所以就了解学习了一番,感觉确实颇为强大,在此再次感谢淘宝资深架构师余庆大神开源了如此优秀的轻量级分布式文件系统,本篇文章就记录一下FastDFS ...

  2. Ajax得到JSON数据

    Ajax得到JSON数据

  3. 【codeforces 733F】Drivers Dissatisfaction

    [题目链接]:http://codeforces.com/problemset/problem/733/F [题意] 给你n个点m条边; 让你从中选出n-1条边; 形成一个生成树; (即让n个点都联通 ...

  4. Maven学习总结(25)——Eclipse Maven Update 时JDK版本变更问题

    1.新建一个Maven项目JDK版本和系统版本不对应, 2.右键Maven项目->Maven->Update ProjectJDK版本改变了, 3.操作系统的JDK重装了新的版本,这是引起 ...

  5. Mybatis动态代理实现函数调用

    如果我们要使用MyBatis进行数据库操作的话,大致要做两件事情: 1. 定义DAO接口 在DAO接口中定义需要进行的数据库操作. 2. 创建映射文件 当有了DAO接口后,还需要为该接口创建映射文件. ...

  6. urlEncoder和urlDecoder的作用和使用

    1.URLEncoder.encode(String s, String enc) 使用指定的编码机制将字符串转换为 application/x-www-form-urlencoded 格式 URLD ...

  7. 怎样注冊 diskgroup 到集群

    之前使用 renamedg  对 ora.CRS.dg 进行重命名ora.DUPCRS.dg 可是 renamedg 有个缺点就是无法将改动的信息同步到整个集群层面,并且改动前的dg 会依旧保留在集群 ...

  8. hdu 2079 选课时间(题目已改动,注意读题) (母函数)

    代码: #include<cstdio> #include<cstring> using namespace std; int main() { int t; scanf(&q ...

  9. RAC连接时的2种方式Connect Time Failver和taf

    1. Client-side Connect Time Failover  在客户端的tnsname中配置多个地址,当用户连接时会按照次序尝试各个地址,直到连接成功,连接好后,不再检测地址是否可用,如 ...

  10. Windows 10 Mobile 演示:系统输入法功能演示

    笔者近期会发布多篇<Windows 10 Mobile 演示>文章,帮助想买 Windows 10 手机的朋友了解 Windows 10 Mobile 系统特色.今天给大家带来 Windo ...