浙江农林大学2021年新生杯程序设计竞赛(同步赛)
生活随笔
收集整理的這篇文章主要介紹了
浙江农林大学2021年新生杯程序设计竞赛(同步赛)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
未來是你們的
#include <iostream> using namespace std;int main() { printf(R"(14 ChenMingjian Bronze Peking University Microsoft|Meituan15 YuKai Silver None Huanle Entertainment|Bytedance16 YingShangwei Silver Zhejiang University Huanle Entertainment|One Smile17 HuangLei Gold None Alibaba18 ZhangYehao Silver None Bytedance19 WangZichao Gold None Alibaba20 YangChengyi Waiting None None)"); }學習使我快樂
#include <iostream> #include <map> using namespace std;map<string, string> ma;int main() {ma["gcd"] = "Greatest common factor";ma["Fast exponentiation algorithm"] = "Fast exponentiation";ma["Disjoint Set Union"] = "Element grouping";ma["Dijkstra"] = "Shortest path";ma["kmp"] = "Pattern string matching";ma["manacher"] = "Palindrome";ma["prim"] = "Minimum spanning tree";ma["Hungarian algorithm"] = "Bipartite graph matching";ma["segment tree"] = "Interval maintenance";ma["Nim"] = "game";ma["Polynomial"] = "Dogs don't learn";int _; cin >> _; cin.get();while (_ -- ){string s; getline(cin, s);cout << ma[s] << endl;} }埃辛諾斯戰刃
#include <iostream> using namespace std;int main() {int n, m; scanf("%d%d", &n, &m);for (int i = 1; i <= n; i ++ ){for (int j = 1; j <= i; j ++ )cout << '*';cout << endl;}for (int i = 1; i <= m; i ++ ){for (int j = 1; j <= n - 1; j ++ )cout << ' ';cout << '*' << endl;}for (int i = 1; i <= n; i ++ ){for (int j = 1; i + j <= n + 1; j ++ )cout << '*';cout << endl;} }神之罰
#include <iostream> using namespace std;const int N = 3010;typedef long long ll;ll row[N], col[N]; ll w[N][N];int main() {int n, m; scanf("%d%d", &n, &m);for (int i = 0; i < n; i ++ )for (int j = 0; j < m; j ++ ){scanf("%lld", &w[i][j]);row[i] += w[i][j];col[j] += w[i][j];}ll mx = 0;for (int i = 0; i < n; i ++ )for (int j = 0; j < m; j ++ )mx = max(mx, row[i] + col[j] - w[i][j]);cout << mx; }隱藏的南通
#include <iostream> #include <algorithm> using namespace std;const int N = 1e5 + 10;typedef pair<int, int> PII;PII a[N];int main() {int n; scanf("%d", &n);for (int i = 0; i < n && scanf("%d", &a[i].first); i ++ );for (int i = 0; i < n && scanf("%d", &a[i].second); i ++ ){if (a[i].first < a[i].second)swap(a[i].first, a[i].second);}sort(a, a + n, greater<PII>());int ans = 1e9;int mx = a[0].second, mi = a[n - 1].first;for (int i = 0; i < n; i ++ ){ans = min(ans, max(mx, a[i].first) - mi);mx = max(mx, a[i].second);mi = min(mi, a[i].second);}cout << ans; }一決01(again)
#include <iostream> using namespace std;const int N = 1010;bool st[N];int main() {for (int i = 1; i <= 1000; i ++ ){for (int j : {1, 2, 9, 20, 24}){if (i >= j && st[i - j] == false)st[i] = true;}}int _; scanf("%d", &_);while (_ -- ){int x; scanf("%d", &x);if (x > 1000) x = x % 500 + 500;if (st[x]) puts("GuaGua shi 1!CeCe shi 0!");else puts("CeCe shi 1!GuaGua shi 0!");} }策策學長的排位日志
#include <iostream> using namespace std;int main() {int n, p, q; cin >> n >> p >> q;int cnt = 0;for (int _ = 0; _ < n; _ ++ ){int kk, dd, aa; cin >> kk >> dd >> aa;int k, d, a;int cntk = 0, cntd = 0;bool ok = true;double kda = 0;if (dd != 0) kda = (kk + aa) * 1.0 / dd;cntk += kk, cntd += dd;for (int i = 0; i < 4; i ++ ){cin >> k >> d >> a;cntk += k, cntd += d;if ((k + a) * 1.0 / d > kda) ok = false;}if (dd == 0) ok = true;if (cntk >= cntd){if (ok) cnt += 2 * p;else cnt += p;}else{if (!ok){if (cnt < 100) cnt -= q;cnt = max(cnt, 0);}}// cout << cntk << ' ' << cntd << endl;}if (cnt >= 100) cout << "YES";else cout << "NO"; }zby 大小姐想讓 zyx 學姐告白
#include <iostream> using namespace std;int main() {int n; scanf("%d", &n);int cnt5 = 0, cnt2 = 0, cnt0 = 0;for (int i = 0, x; i < n && scanf("%d", &x); i ++ ){if (x == 5) cnt5 ++ ;else if (x == 2) cnt2 ++ ;else if (x == 0) cnt0 ++ ;}cout << min(cnt5, min(cnt2, cnt0)); }zby 大小姐想讓 zyx 學姐告白之大反派 ycy
#include <iostream> using namespace std;int main() {int n; scanf("%d", &n);int cnt5 = 0, cnt2 = 0, res = 0;for (int i = 0, x; i < n && scanf("%d", &x); i ++ ){if (x == 5) cnt5 ++ ;else if (x == 2 && cnt5) cnt5 -- , cnt2 ++ ;else if (x == 0 && cnt2) cnt2 -- , res ++ ;}cout << res; }至高無上的教皇
#include <iostream> using namespace std;const int N = 3e3 + 10;int h[N], cnt[N];int main() {int n; scanf("%d", &n);for (int i = 0; i < n && scanf("%d", &h[i]); i ++ );for (int i = 0; i < n; i ++ ){double mx;for (int j = i + 1; j < n; j ++ ){double t = (h[j] - h[i]) * 1.0 / (j - i);if (j == i + 1) cnt[i] ++ , cnt[j] ++ , mx = t;else if (t > mx){mx = t;cnt[i] ++ , cnt[j] ++ ;}}}for (int i = 0; i < n; i ++ ) printf("%d ", cnt[i]); }教皇的達拉崩巴
#include <iostream> #include <cmath> using namespace std;typedef long long ll;int main() {int _; scanf("%d", &_);while (_ -- ){ll x, y; scanf("%lld%lld", &x, &y);ll res = sqrt(x * y);if (res * res == x * y) puts("zhl he zwc tie tie");else puts("zyx he zby tie tie");} }總結
以上是生活随笔為你收集整理的浙江农林大学2021年新生杯程序设计竞赛(同步赛)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 第九届蓝桥杯大赛软件赛省赛 C/C++
- 下一篇: 洛谷【算法1-4】递推与递归