[HZAU]华中农业大学第四届程序设计大赛网络同步赛

  听说是邀请赛啊,大概做了做…中午出去吃了个饭回来过掉的I。然后去做作业了……

 1 #include <algorithm>
 2 #include <iostream>
 3 #include <iomanip>
 4 #include <cstring>
 5 #include <climits>
 6 #include <complex>
 7 #include <fstream>
 8 #include <cassert>
 9 #include <cstdio>
10 #include <bitset>
11 #include <vector>
12 #include <deque>
13 #include <queue>
14 #include <stack>
15 #include <ctime>
16 #include <set>
17 #include <map>
18 #include <cmath>
19
20 using namespace std;
21
22 #define fr first
23 #define sc second
24 #define pb(a) push_back(a)
25 #define Rint(a) scanf("%d", &a)
26 #define Rll(a) scanf("%I64d", &a)
27 #define Rs(a) scanf("%s", a)
28 #define FRead() freopen("in", "r", stdin)
29 #define FWrite() freopen("out", "w", stdout)
30 #define Rep(i, len) for(int i = 0; i < (len); i++)
31 #define For(i, a, len) for(int i = (a); i < (len); i++)
32 #define Cls(a) memset((a), 0, sizeof(a))
33 #define Full(a) memset((a), 0x7f7f, sizeof(a))
34
35 typedef long long ll;
36 const int maxn = 33;
37 string s;
38 int g[3];
39
40 int main() {
41     // FRead();
42     int T;
43     Rint(T);
44     while(T--) {
45         string pre;
46         int pos = 0;
47         Cls(g);
48         while(cin >> s) {
49             if(s[0] == ‘E‘) break;
50             if(::s == pre) {
51                 pos = 1 - pos;
52                 g[pos]++;
53                 pre = ::s;
54             }
55             else {
56                 g[pos]++;
57                 pre = ::s;
58             }
59         }
60         // cout << g[0] <<  " "<< g[1] <<endl;
61         printf("%d\n", g[0] * g[1]);
62     }
63     return 0;
64 }

C

 1 #include <algorithm>
 2 #include <iostream>
 3 #include <iomanip>
 4 #include <cstring>
 5 #include <climits>
 6 #include <complex>
 7 #include <fstream>
 8 #include <cassert>
 9 #include <cstdio>
10 #include <bitset>
11 #include <vector>
12 #include <deque>
13 #include <queue>
14 #include <stack>
15 #include <ctime>
16 #include <set>
17 #include <map>
18 #include <cmath>
19
20 using namespace std;
21
22 #define fr first
23 #define sc second
24 #define pb(a) push_back(a)
25 #define Rint(a) scanf("%d", &a)
26 #define Rll(a) scanf("%I64d", &a)
27 #define Rs(a) scanf("%s", a)
28 #define FRead() freopen("in", "r", stdin)
29 #define FWrite() freopen("out", "w", stdout)
30 #define Rep(i, len) for(int i = 0; i < (len); i++)
31 #define For(i, a, len) for(int i = (a); i < (len); i++)
32 #define Cls(a) memset((a), 0, sizeof(a))
33 #define Full(a) memset((a), 0x7f7f, sizeof(a))
34
35 typedef long long ll;
36 ll n, k;
37
38 int main() {
39     // FRead();
40     while(~Rint(n) && ~Rint(k)) {
41         ll t;
42         while(1) {
43             if(t == n) break;
44             t = n;
45             n /= 2;
46             n += k;
47         }
48         cout << t << endl;
49     }
50     return 0;
51 }

H

 1 #include <algorithm>
 2 #include <iostream>
 3 #include <iomanip>
 4 #include <cstring>
 5 #include <climits>
 6 #include <complex>
 7 #include <fstream>
 8 #include <cassert>
 9 #include <cstdio>
10 #include <bitset>
11 #include <vector>
12 #include <deque>
13 #include <queue>
14 #include <stack>
15 #include <ctime>
16 #include <set>
17 #include <map>
18 #include <cmath>
19
20 using namespace std;
21
22 #define fr first
23 #define sc second
24 #define pb(a) push_back(a)
25 #define Rint(a) scanf("%d", &a)
26 #define Rll(a) scanf("%I64d", &a)
27 #define Rs(a) scanf("%s", a)
28 #define FRead() freopen("in", "r", stdin)
29 #define FWrite() freopen("out", "w", stdout)
30 #define Rep(i, len) for(int i = 0; i < (len); i++)
31 #define For(i, a, len) for(int i = (a); i < (len); i++)
32 #define Cls(a) memset((a), 0, sizeof(a))
33 #define Full(a) memset((a), 0x7f7f, sizeof(a))
34
35 const int maxn = 11;
36 double n, V;
37 double a[maxn], v[maxn];
38 double ans;
39
40 int main() {
41     // FRead();
42     while(cin >> n >> V) {
43         bool exflag = 0;
44         ans = 0;
45         Rep(i, n) {
46             cin >> a[i] >> v[i];
47             if(abs(v[i]) >= V && a[i] != 0) exflag = 1;
48         }
49         if(exflag) {
50             printf("Bad Dog\n");
51             continue;
52         }
53         double pos = 0;
54         Rep(i, n) {
55             a[i] += ans * v[i];
56             if(a[i] == pos) continue;
57             if(a[i] < pos) V = -1 * abs(V);
58             else V = abs(V);
59             if(abs(V - v[i]) <= 0) {
60                 exflag = 1;
61                 break;
62             }
63             double d = abs(pos - a[i]);
64             double t = d / abs(V - v[i]);
65             ans += t;
66             pos += t * V;
67         }
68         if(exflag) printf("Bad Dog\n");
69         else printf("%.2lf\n", ans);
70     }
71     return 0;
72 }

I

 1 #include <algorithm>
 2 #include <iostream>
 3 #include <iomanip>
 4 #include <cstring>
 5 #include <climits>
 6 #include <complex>
 7 #include <fstream>
 8 #include <cassert>
 9 #include <cstdio>
10 #include <bitset>
11 #include <vector>
12 #include <deque>
13 #include <queue>
14 #include <stack>
15 #include <ctime>
16 #include <set>
17 #include <map>
18 #include <cmath>
19
20 using namespace std;
21
22 #define fr first
23 #define sc second
24 #define pb(a) push_back(a)
25 #define Rint(a) scanf("%d", &a)
26 #define Rll(a) scanf("%I64d", &a)
27 #define Rs(a) scanf("%s", a)
28 #define FRead() freopen("in", "r", stdin)
29 #define FWrite() freopen("out", "w", stdout)
30 #define Rep(i, len) for(int i = 0; i < (len); i++)
31 #define For(i, a, len) for(int i = (a); i < (len); i++)
32 #define Cls(a) memset((a), 0, sizeof(a))
33 #define Full(a) memset((a), 0x7f7f, sizeof(a))
34
35 const int maxn = 2020;
36 int h[maxn];
37 int ans;
38 int n;
39
40 int check(int d) {
41     int ret = 0;
42     int tmp = 0;
43     for(int i = 1; i <= 2000; i++) {
44         tmp = 0;
45         if(h[i] == 0) continue;
46         for(int j = i; j <= 2000; j+=d) {
47             if(h[j]) tmp++;
48             else break;
49         }
50         ret = max(tmp, ret);
51     }
52     return ret;
53 }
54
55 int main() {
56     // FRead();
57     int tmp;
58     while(~Rint(n)) {
59         Cls(h);
60         ans = 0;
61         Rep(i, n) {
62             Rint(tmp);
63             h[tmp]++;
64         }
65         //d = 0
66         for(int i = 1; i <= 2000; i++) {
67             ans = max(ans, h[i]);
68         }
69         for(int d = 1; d <= 2000; d++) {
70             ans = max(ans, check(d));
71         }
72         cout << ans << endl;
73     }
74     return 0;
75 }

J

时间: 2024-10-01 04:17:29

[HZAU]华中农业大学第四届程序设计大赛网络同步赛的相关文章

华中农业大学第四届程序设计大赛网络同步赛 I

Problem I: Catching Dogs Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 1130  Solved: 292[Submit][Status][Web Board] Description Diao Yang keeps many dogs. But today his dogs all run away. Diao Yang has to catch them. To simplify the problem, we assu

华中农业大学第四届程序设计大赛网络同步赛 J

Problem J: Arithmetic Sequence Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 1766  Solved: 299[Submit][Status][Web Board] Description Giving a number sequence A with length n, you should choosing m numbers from A(ignore the order) which can form an

华中农业大学第四届程序设计大赛网络同步赛 G.Array C 线段树或者优先队列

Problem G: Array C Time Limit: 1 Sec  Memory Limit: 128 MB Description Giving two integers  and  and two arrays  and  both with length , you should construct an array  also with length  which satisfied: 1.0≤Ci≤Ai(1≤i≤n) 2. and make the value S be min

华中农业大学第五届程序设计大赛网络同步赛解题报告(转)

A.Little Red Riding Hood B.Choosy in Food •F[i]:从第I个点到终点的期望步数 •F[i] = (F[i + k] + k ) * P[k] •F[ed] = 0 •高斯消元求解 •注意存在从起点不能到达终点的情况 C.Friends •F[rt][len] :节点rt的子孙里,距离rt的为len的节点个数 •ans[rt][len] : 整棵树上,距离rt为len的节点个数 •F值一次简单的深搜可以得到 •而ans[rt][len] = F[rt][

华中农业大学第五届程序设计大赛网络同步赛题解

A.Little Red Riding Hood B.Choosy in Food •F[i]:从第I个点到终点的期望步数 •F[i] = (F[i + k] + k ) * P[k] •F[ed] = 0 •高斯消元求解 •注意存在从起点不能到达终点的情况 C.Friends •F[rt][len] :节点rt的子孙里,距离rt的为len的节点个数 •ans[rt][len] : 整棵树上,距离rt为len的节点个数 •F值一次简单的深搜可以得到 •而ans[rt][len] = F[rt][

华中农业大学第五届程序设计大赛 (7/12)

今天实在累了,还有的题晚点补.... 题目链接:http://acm.hzau.edu.cn/problemset.php?page=3 题目:acm.hzau.edu.cn/5th.pdf A:Little Red Riding Hood 题意:给你n朵花,每朵花有个权值,然后每次取花最少要间隔k朵,求权值最大: 思路:简单dp: #pragma comment(linker, "/STACK:1024000000,1024000000") #include<iostream&

2017年西南民族大学程序设计竞赛-网络同步赛(代码)

20598954 nmphy D 答案正确 8 512 486 C++ 2017-12-30 14:30:35 20598712 nmphy E 答案正确 3 504 695 C++ 2017-12-30 14:25:59 20598181 nmphy E 答案正确 3 484 659 C++ 2017-12-30 14:15:16 20597638 nmphy E 答案正确 3 504 505 C++ 2017-12-30 14:05:08//比赛时候这里显示的是WA,而且显示准确率5% 20

2017年西南民族大学程序设计竞赛-网络同步赛

题目描述 现在有一个N*M的矩形星图.其中包括恒星和黑洞.恒星可以向上.下.左.右发射光束,且允许光束从其中穿过:黑洞会吸收所有经过的光束. 若一颗恒星向上.下.左.右发射光束,你能告诉我,该光束能否避免被黑洞吸收,进入星图之外的区域么? 输入描述: 单组输入.第一行三个正整数N,M,Q(1 <= N,M<= 1000,1 <= Q <= 1000000),分别表示矩阵的行列,以及询问的个数,询问之间相互独立.然后一个N*M的矩阵,由’*’和’#’构成,表示星图.’*’表示恒星,’

西安电子科技大学第16届程序设计竞赛网络同步赛 G-小国的复仇

sb找规律. 分解因数. 1 #include<bits/stdc++.h> 2 #define LL long long 3 #define fi first 4 #define se second 5 #define mk make_pair 6 using namespace std; 7 8 const int N=1e6+7; 9 const int M=100+7; 10 const int inf=0x3f3f3f3f; 11 const LL INF=0x3f3f3f3f3f3