T1:New Scheme
模拟
代码实现
def solve():
s = list(map(int, input().split()))
for i in range(8):
if s[i]%25 != 0:
return False
if s[i] < 100 or s[i] > 675:
return False
for i in range(7):
if s[i] > s[i+1]:
return False
return True
if solve():
print('Yes')
else:
print('No')
T2:Default Price
模拟
代码实现
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<string> c(n), d(m+1);
vector<int> p(m+1);
rep(i, n) cin >> c[i];
rep(i, m) cin >> d[i+1];
rep(i, m+1) cin >> p[i];
map<string, int> mp;
rep(i, m) mp[d[i+1]] = p[i+1];
int ans = 0;
rep(i, n) {
int price = mp[c[i]];
if (price == 0) price = p[0];
ans += price;
}
cout << ans << '\n';
return 0;
}