2021.7.7
记录:赛中过了C和H
TH Fetch spring water
题意:给一个如图所示的水箱,问最多能装多少水。
idea:直接得答案
ACcode:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ULL unsigned long long
using namespace std;
ULL a,b,h1,h2,ans,h;
int main()
{
cin>>a>>b>>h1>>h2;
h = h1+h2;
if( a%2==0 )
{
a/=2;
}
else if( b%2==0 )
{
b/=2;
}
else if( h%2==0 )
{
h /= 2;
}
ans = a*b*h;
cout<<ans;
return 0;
}
TC Schedule
题意:实现一个课程表功能,大模拟题。
ACcode:
#include <cstdio>
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
#include <cstring>
using namespace std;
const int MAXN = 10011;
int n, q;
char cn[MAXN][100];
char mp[255];
int sch[5][13][MAXN][2]; // [weekday][sl][week][course/el]
int main() {
//freopen("in.txt","r",stdin);
scanf("%d\n", &n);
mp['o'] = 0, mp['u'] = 1, mp['e'] = 2, mp['h'] = 3, mp['r'] = 4;
for (int i = 1; i <= n; i++)
{
cin.getline(cn[i], 100);
cn[i][strlen(cn[i]) - 1] = '\0';
int sw, ew, sl, el, wd;
char dn[10];
while (scanf("%d-%d%s%d-%d\n", &sw, &ew, dn, &sl, &el) == 5)
{
wd = mp[dn[1]];
for (int j = sw; j <= ew; j++)
{
sch[wd][sl][j][0] = i;
sch[wd][sl][j][1] = el;
}
}
if (i == n) q = sw;
}
while (q--)
{
int wk, wd;
char dn[10];
scanf("%d%s", &wk, dn);
wd = mp[dn[1]];
for (int i = 1; i <= 12; i++) {
int *x = sch[wd][i][wk];
if (x[0]) printf("%d-%d %s\n", i, x[1], cn[x[0]]);
}
if (q) puts("");
}
}