A.Calandar
模拟 签到
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int T;
string tem[]={"Monday","Tuesday","Wednesday","Thursday","Friday"};
int main()
{
cin>>T;
while(T--)
{
int a1,b1,c1,a2,b2,c2;
string str;
int id;
cin>>a1>>b1>>c1>>str>>a2>>b2>>c2;
for(int i=0;i<5;i++)
if(str==tem[i])id=i;
int m = c2-c1;
m = (m+30)%5;
// cout<<m<<endl;
id =(id+m)%5;
cout<<tem[id]<<endl;
}
}
M.Sekiro
数学 签到
#include<iostream>
using namespace std;
typedef long long ll;
int T;
ll qmi(ll a,ll b)
{
ll res=1;
while(b)
{
if(b&1)res=res*a;
b>>=1;
a*=a;
}
return res;
}
int main()
{
cin>>T;
while(T--)
{
ll a,b;
cin>>a>>b;
if(!a)cout<<0<<endl;
else if(b>31)cout<<1<<endl;
else
{
ll tem=qmi(2,b);
cout<<(a+tem-1)/tem<<endl;
}
}
}
D.Game on a Graph
博弈 签到
注意取模不然很坑
#include<bits/stdc++.h>
using namespace std;
string str;
int T;
int k;
int n,m;
int a,b;
int main()
{
cin>>T;
while(T--)
{
cin>>k;
cin>>str;
cin>>n>>m;
int t = m-n+1;
while(m--)
{
cin>>a>>b;
}
if(t)
{
if(str[t%k]=='1')puts("2");
else puts("1");
}else
{
if(str[0] =='1')puts("2");
else puts("1");
}
}
}
F.Stone in the Bucket
贪心 签到
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
typedef long long ll;
int T;
int n;
ll a[N];
int main()
{
cin>>T;
while(T--)
{
cin>>n;
ll sum = 0;
for(int i=1;i<=n;i++)cin>>a[i],sum+=a[i];
ll res=0;
res+=sum%n;
sum = sum - sum%n;
ll op =sum/n;
for(int i=1;i<=n;i++)
if(a[i]<op)res+=(op-a[i]);
cout<<res<<endl;
}
}