A.Tokitsukaze and Bracelet
Code:
#include<bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b, c, cnt = 0; cin >> a >> b >> c; if (a >= 150) cnt++; if (a >= 200) cnt++; if (b >= 34) cnt++; if (b >= 45) cnt++; if (c >= 34) cnt++; if (c >= 45) cnt++; cout << cnt << '\n'; } return 0; }
B.Tokitsukaze and Cats
Code:
#include<bits/stdc++.h> using namespace std; int arr[305][305]; int main() { int n, m, k; cin >> n >> m >> k; int ans = k * 4;//总个数 while (k--) { int x, y; cin >> x >> y; arr[x][y] = 1; } for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { if (arr[i][j]) { if (arr[i + 1][j]) ans--; if (arr[i][j + 1]) ans--; } } cout << ans << '\n'; return 0; }
标签:cnt,arr,int,++,cin,2024,牛客,集训营 From: https://www.cnblogs.com/youhualiuh/p/18008661