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.
Arpa wants to know how many spectators are standing at time t.
The first line contains three integers n, k, t (1 ≤ n ≤ 109, 1 ≤ k ≤ n, 1 ≤ t < n + k).
Print single integer: how many spectators are standing at time t.
10 5 3
3
10 5 7
5
10 5 12
In the following a sitting spectator is represented as -, a standing spectator is represented as ^.
题意:自己读一读就行
解法:暗中观察
1 #include<bits/stdc++.h> 2 using namespace std; 3 int main(){ 4 int n,k,t; 5 cin>>n>>k>>t; 6 if(k>=t){ 7 cout<<t<<endl; 8 }else if(t<=n){ 9 cout<<k<<endl; 10 }else if(n+k<=t){ 11 cout<<"0"<<endl; 12 }else{ 13 cout<<k-(t-n)<<endl; 14 } 15 return 0; 16 }
Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) A
原文:http://www.cnblogs.com/yinghualuowu/p/7482856.html