K - KazaQ’s Socks

Bryce1010模板

这里写图片描述

#include <bits/stdc++.h>

using namespace std;

#define LL long long


int main()
{
    LL n,k;
    LL ca=1;
    while(cin>>n>>k)
    {
        if(k<=n)
            cout<<"Case #"<<ca++<<": "<<k<<endl;
        else
        {
            LL tmp=(k-n)%(2*(n-1));
           // cout<<tmp<<endl;
            if(tmp==0)cout<<"Case #"<<ca++<<": "<<n<<endl;
            else if(tmp==n-1)cout<<"Case #"<<ca++<<": "<<n-1<<endl;
            else
            {
                cout<<"Case #"<<ca++<<": "<<tmp%(n-1)<<endl;
            }
        }
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/Fire_to_cheat_/article/details/80726175
k8s