Arpa is researching the Mexican wave.

There are n spectators in the stadium, labeled from 1 to n. They start the Mexican wave at time 0.

  • At time 1, the first spectator stands.
  • At time 2, the second spectator stands.
  • ...
  • At time k, the k-th spectator stands.
  • At time k + 1, the (k + 1)-th spectator stands and the first spectator sits.
  • At time k + 2, the (k + 2)-th spectator stands and the second spectator sits.
  • ...
  • At time n, the n-th spectator stands and the (n - k)-th spectator sits.
  • At time n + 1, the (n + 1 - k)-th spectator sits.
  • ...
  • At time n + k, the n-th spectator sits.

Arpa wants to know how many spectators are standing at time t.

Input

The first line contains three integers nkt (1 ≤ n ≤ 109, 1 ≤ k ≤ n, 1 ≤ t < n + k).

Output

Print single integer: how many spectators are standing at time t.

Examples
input
10 5 3
output
3
input
10 5 7
output
5
input
10 5 12
output
3
Note

In the following a sitting spectator is represented as -, a standing spectator is represented as ^.

  • At t = 0  ----------  number of standing spectators = 0.
  • At t = 1  ^---------  number of standing spectators = 1.
  • At t = 2  ^^--------  number of standing spectators = 2.
  • At t = 3  ^^^-------  number of standing spectators = 3.
  • At t = 4  ^^^^------  number of standing spectators = 4.
  • At t = 5  ^^^^^-----  number of standing spectators = 5.
  • At t = 6  -^^^^^----  number of standing spectators = 5.
  • At t = 7  --^^^^^---  number of standing spectators = 5.
  • At t = 8  ---^^^^^--  number of standing spectators = 5.
  • At t = 9  ----^^^^^-  number of standing spectators = 5.
  • At t = 10 -----^^^^^  number of standing spectators = 5.
  • At t = 11 ------^^^^  number of standing spectators = 4.
  • At t = 12 -------^^^  number of standing spectators = 3.
  • At t = 13 --------^^  number of standing spectators = 2.
  • At t = 14 ---------^  number of standing spectators = 1.
  • At t = 15 ----------  number of standing spectators = 0.

题意:自己读一读就行

解法:暗中观察

 #include<bits/stdc++.h>
using namespace std;
int main(){
int n,k,t;
cin>>n>>k>>t;
if(k>=t){
cout<<t<<endl;
}else if(t<=n){
cout<<k<<endl;
}else if(n+k<=t){
cout<<""<<endl;
}else{
cout<<k-(t-n)<<endl;
}
return ;
}

Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) A的更多相关文章

  1. D. Arpa and a list of numbers Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017)

    http://codeforces.com/contest/851/problem/D 分区间操作 #include <cstdio> #include <cstdlib> # ...

  2. Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017)ABCD

    A. Arpa and a research in Mexican wave time limit per test 1 second memory limit per test 256 megaby ...

  3. Codeforces Round #432 (Div. 1, based on IndiaHacks Final Round 2017) D. Tournament Construction(dp + 构造)

    题意 一个竞赛图的度数集合是由该竞赛图中每个点的出度所构成的集合. 现给定一个 \(m\) 个元素的集合,第 \(i\) 个元素是 \(a_i\) .(此处集合已经去重) 判断其是否是一个竞赛图的度数 ...

  4. 【前缀和】【枚举倍数】 Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) D. Arpa and a list of numbers

    题意:给你n个数,一次操作可以选一个数delete,代价为x:或者选一个数+1,代价y.你可以进行这两种操作任意次,让你在最小的代价下,使得所有数的GCD不为1(如果全删光也视作合法). 我们从1到m ...

  5. 【推导】【暴力】Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) C. Five Dimensional Points

    题意:给你五维空间内n个点,问你有多少个点不是坏点. 坏点定义:如果对于某个点A,存在点B,C,使得角BAC为锐角,那么A是坏点. 结论:如果n维空间内已经存在2*n+1个点,那么再往里面添加任意多个 ...

  6. 【推导】Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) B. Arpa and an exam about geometry

    题意:给你平面上3个不同的点A,B,C,问你能否通过找到一个旋转中心,使得平面绕该点旋转任意角度后,A到原先B的位置,B到原先C的位置. 只要A,B,C构成等腰三角形,且B为上顶点.那么其外接圆圆心即 ...

  7. Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) D

    Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and g ...

  8. Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) C

    You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two poi ...

  9. Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) B

    Arpa is taking a geometry exam. Here is the last problem of the exam. You are given three points a,  ...

随机推荐

  1. javascript(7)

    js中基于对象==js面向对象 js中没有类class,但是它 JavaScript是一种面向(基于)对象的动态脚本语言,是一种基于对象和事件驱动并具有安全性能的脚本语言.它具有面向对象语言所特有的各 ...

  2. Windows内存性能分析(二)性能瓶颈

    内存瓶颈: 由于可用内存缺乏导致系统性能下降的现像. (一).相关的性能对象 主要考虑内存的页面操作和磁盘的I/O操作,需要考虑如下性能对象: Memory性能对象: 用于分析整个系统的内存瓶颈问题. ...

  3. homebrew cask安装launch rocket【转】

    简介 brew cask是一个用命令行管理Mac下应用的工具,它是基于homebrew的一个增强工具. homebrew可以管理Mac下的命令行工具,例如imagemagick, nodejs,如下所 ...

  4. zero to one (2)

    kali虚拟机整理 关于kali的虚拟机,我搞崩过很多次,重新安装了很多次,也遇到了很多问题,有一些解决不了的就重新安装,费时费力,要善于用虚拟机. 关于网络配置的问题 关于网络配置,在这里我想主要记 ...

  5. Mysql常用命令行大全(三)

    /**操作数据库*/ SHOW DATABASES; CREATE DATABASE db; SHOW DATABASES; DROP DATABASE db; /**操作表*/ USE  db; S ...

  6. POJ1195(二维树状数组)

    Mobile phones Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 17176   Accepted: 7920 De ...

  7. ScrollView cannot scroll in Slidinguppanellayout 解决办法

    xml源码如下 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:an ...

  8. 【opencv学习笔记四】opencv3.4.0图形用户接口highgui函数解析

    在笔记二中我们已经知道了,在highgui文件夹下的正是opencv图形用户接口功能结构,我们这篇博客所说的便是D:\Program Files\opencv340\opencv\build\incl ...

  9. JavaScript高级程序设计学习笔记第八章--BOM

    1.间歇调用和超时调用: 超时调用:需要使用 window 对象的 setTimeout()方法,它接受两个参数:要执行的代码和以毫秒表示的时间(即在执行代码前需要等待多少毫秒).其中,第一个参数可以 ...

  10. matlab下的caffe接口配置(Windows)

    本文基于大部分网上方法 http://blog.csdn.net/d5224/article/details/51916178,外加一点自己的个人实际配置经历,环境变量在配置后尽管显示正确并且重启多次 ...