题意:给出n,k,t
其实题意和怎么写都在这张图里
1 #include<bits/stdc++.h> 2 using namespace std; 3 4 int main(){ 5 int n,k,t; 6 cin>>n>>k>>t; 7 if(t<=k){ 8 cout<<t<<endl; 9 } 10 else if(t>=n){ 11 cout<<max(0,k-(t-n))<<endl; 12 } 13 else cout<<k<<endl; 14 }
题意:给出n,k,t
其实题意和怎么写都在这张图里
1 #include<bits/stdc++.h> 2 using namespace std; 3 4 int main(){ 5 int n,k,t; 6 cin>>n>>k>>t; 7 if(t<=k){ 8 cout<<t<<endl; 9 } 10 else if(t>=n){ 11 cout<<max(0,k-(t-n))<<endl; 12 } 13 else cout<<k<<endl; 14 }