摘要:
A. Kamilka and the Sheep 题意:给你\(n\)个数,给每个数加上一个非负整数后,选出两个数使得它们的\(gcd\)最大。 因为\(gcd(x, y) = gcd(x, y - x)\)。然后我猜是\(max-min\)。 点击查看代码 void solve() { int n 阅读全文
摘要:
A - Hamming Distance 点击查看代码 void solve() { int n; std::cin >> n; std::string s, t; std::cin >> s >> t; int ans = 0; for (int i = 0; i < n; ++ i) { ans 阅读全文
摘要:
A. Commentary Boxes 题意:把\(n\)变成\(m\)的倍数,每次加一花费\(a\),每次加一花费\(b\)。求最小花费。 点击查看代码 void solve() { i64 n, m, a, b; std::cin >> n >> m >> a >> b; std::cout < 阅读全文
摘要:
A. Tetris 找每一列的最小值。 点击查看代码 void solve() { int n, m; std::cin >> n >> m; std::vector<int> cnt(n); for (int i = 0; i < m; ++ i) { int x; std::cin >> x; 阅读全文
摘要:
A. Treasure Hunt 点击查看代码 void solve() { int x, y, a; std::cin >> x >> y >> a; a %= (x + y); if (a < x) { std::cout << "NO\n"; } else { std::cout << "YE 阅读全文
摘要:
A. Diagonal Walking 模拟 点击查看代码 void solve() { int n; std::cin >> n; std::string s; std::cin >> s; int ans = n; for (int i = 0; i + 1 < n; ++ i) { if (( 阅读全文