A - Calandar.
题意:给两个日期,规定每年12个月,每月30天,已知第一个日期是星期几,求第二个日期是星期几;
分析:水题。
#include <iostream>
#include <cstdio>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cstring>
#include <algorithm>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
#define mp make_pair
#define pb push_back
#define T int T;scanf("%d",&T);while(T--)
const ll mod=1e9+7;
int main(){
ll y1,y,m1,m,d1,d;
string s;
ll ans1,ans;
map<string,int> ss;
string sss[5]={
"Monday","Tuesday","Wednesday","Thursday","Friday"};
string sss1[5]={
"Friday","Thursday","Wednesday","Tuesday","Monday"};
ss["Monday"] = 0;
ss["Tuesday"] = 1;
ss["Wednesday"] = 2;
ss["Thursday"] = 3;
ss["Friday"] = 4;
T{
scanf("%lld %lld %lld", &y, &m, &d);
cin >> s;
scanf("%lld %lld %lld", &y1, &m1, &d1);
ans = y*360ll+m*30ll+d;
ans1 = y1*360ll+m1*30ll+d1;
if(ans1>=ans){
ans1 = (ans1 - ans + ss[s]) % 5;
cout << sss[ans1] << endl;
}else{
ans1 = (ans - ans1 + 4 - ss[s]) % 5;
cout << sss1[ans1] << endl;
}
}
return 0;
}
D - Game on a Graph.
题意:已知一个n个点,m条边的连通图,k个人,每个人有编号1或2表示队伍,按顺序每次没人删一条边,如果删去一条边之后图不连通,则该队输,输出赢的队伍的编号。
分析:n个点要连通至少n-1条边,所以可以删去m-n+1条边。取余人数即可
#include <