HRBUST寒假训练20200218

https://vjudge.net/contest/356457
A题 数论

#include 

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

ll t,n,tmp;

ll gcd(ll a,ll b)
{
    if(a%b==0)
        return b;
    return gcd(b,a%b);
}


int main()
{
    ios::sync_with_stdio(false);
    cin>>t;
    while(t--)
    {
        cin>>n;
        if(n==180)
        {
            cout<<-1<<endl;
            continue;
        }
        tmp=180;
        ll fac = gcd(n,tmp);
        n/=fac;
        tmp/=fac;

        for(ll i=1;;i++)
        {
            if(tmp-n>=2)
            {
                cout<<tmp<<endl;
                break;
            }
            tmp*=i;
            n*=i;
        }

    }
    return 0;
}

B题 并查集
https://blog.csdn.net/qq_42937838/article/details/104379797

C题 贪心
https://blog.csdn.net/qq_42937838/article/details/104379834

D题 动态规划
https://blog.csdn.net/qq_42937838/article/details/104379872

E,F应该是两题模拟,待补

你可能感兴趣的:(HRBUST,补题)