C. JoyboardCodeforces Round 902

C. Joyboard

样例1列表找规律:
C. JoyboardCodeforces Round 902_第1张图片

#include
#define int long long
using namespace std;
signed main()
{
    int T;cin>>T;
    while(T--){
        int n,m,k;cin>>n>>m>>k;
        if(k==1){
            cout<<1<<endl;
        }else if(k==2){
            cout<<min(n-1,m)+m/n<<endl;
        }else if(k==3){
            cout<<m-min(n-1,m)-m/n<<endl;
        }else{
            cout<<0<<endl;
        }
    }
}

你可能感兴趣的:(算法,数据结构)