AtCoder Beginning Contest 139

Posted jhseng

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AtCoder Beginning Contest 139相关的知识,希望对你有一定的参考价值。

很傻的一场。

题目链接:https://atcoder.jp/contests/abc139/


A:

傻题。

技术图片
 1 /* basic header */
 2 #include <bits/stdc++.h>
 3 /* define */
 4 #define ll long long
 5 #define dou double
 6 #define pb emplace_back
 7 #define mp make_pair
 8 #define sot(a,b) sort(a+1,a+1+b)
 9 #define rep1(i,a,b) for(int i=a;i<=b;++i)
10 #define rep0(i,a,b) for(int i=a;i<b;++i)
11 #define eps 1e-8
12 #define int_inf 0x3f3f3f3f
13 #define ll_inf 0x7f7f7f7f7f7f7f7f
14 #define lson (curpos<<1)
15 #define rson (curpos<<1|1)
16 /* namespace */
17 using namespace std;
18 /* header end */
19 
20 const int maxn=1e5+10;
21 char s[maxn],t[maxn];
22 
23 int main() 
24     scanf("%s",s+1);
25     scanf("%s",t+1);
26     int ans=0;
27     for (int i=1;i<=3;i++)
28         ans+=s[i]==t[i];
29     printf("%d\n",ans);
30     return 0;
31 
View Code

B:

枚举就好了。

技术图片
 1 /* basic header */
 2 #include <bits/stdc++.h>
 3 /* define */
 4 #define ll long long
 5 #define dou double
 6 #define pb emplace_back
 7 #define mp make_pair
 8 #define sot(a,b) sort(a+1,a+1+b)
 9 #define rep1(i,a,b) for(int i=a;i<=b;++i)
10 #define rep0(i,a,b) for(int i=a;i<b;++i)
11 #define eps 1e-8
12 #define int_inf 0x3f3f3f3f
13 #define ll_inf 0x7f7f7f7f7f7f7f7f
14 #define lson (curpos<<1)
15 #define rson (curpos<<1|1)
16 /* namespace */
17 using namespace std;
18 /* header end */
19 
20 int a, b;
21 
22 int main() 
23     while (scanf("%d%d", &a, &b) != EOF) 
24         int curr=1,ans=0;
25         while (curr<b)
26             curr+=a-1;
27             ans++;
28         
29         printf("%d\n",ans);
30     
31     return 0;
32 
View Code

C:

倒着扫一次就好了。

技术图片
 1 /* basic header */
 2 #include <bits/stdc++.h>
 3 /* define */
 4 #define ll long long
 5 #define dou double
 6 #define pb emplace_back
 7 #define mp make_pair
 8 #define sot(a,b) sort(a+1,a+1+b)
 9 #define rep1(i,a,b) for(int i=a;i<=b;++i)
10 #define rep0(i,a,b) for(int i=a;i<b;++i)
11 #define eps 1e-8
12 #define int_inf 0x3f3f3f3f
13 #define ll_inf 0x7f7f7f7f7f7f7f7f
14 #define lson (curpos<<1)
15 #define rson (curpos<<1|1)
16 /* namespace */
17 using namespace std;
18 /* header end */
19 
20 const int maxn = 1e5 + 10;
21 int n, a[maxn];
22 
23 int main() 
24     scanf("%d", &n);
25     for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
26     int ans = 0, cnt = 0;
27     for (int i = n; i > 1; i--) 
28         if (a[i] <= a[i - 1]) cnt++;
29         else 
30             ans = max(ans, cnt);
31             cnt = 0;
32         
33     
34     ans = max(ans, cnt);
35     printf("%d\n", ans);
36     return 0;
37 
View Code

D:

打个表就知道答案。

技术图片
 1 /* basic header */
 2 #include <bits/stdc++.h>
 3 /* define */
 4 #define ll long long
 5 #define dou double
 6 #define pb emplace_back
 7 #define mp make_pair
 8 #define sot(a,b) sort(a+1,a+1+b)
 9 #define rep1(i,a,b) for(int i=a;i<=b;++i)
10 #define rep0(i,a,b) for(int i=a;i<b;++i)
11 #define eps 1e-8
12 #define int_inf 0x3f3f3f3f
13 #define ll_inf 0x7f7f7f7f7f7f7f7f
14 #define lson (curpos<<1)
15 #define rson (curpos<<1|1)
16 /* namespace */
17 using namespace std;
18 /* header end */
19 
20 ll n;
21 
22 int main() 
23     scanf("%lld", &n);
24     printf("%lld\n", (1ll + (n - 1)) * (n - 1) / 2);
25     return 0;
26 
View Code

E:

队友说是模拟。(完全不想写

F:

n方暴力完事。

技术图片
 1 /* basic header */
 2 #include <bits/stdc++.h>
 3 /* define */
 4 #define ll long long
 5 #define dou double
 6 #define pb emplace_back
 7 #define mp make_pair
 8 #define sot(a,b) sort(a+1,a+1+b)
 9 #define rep1(i,a,b) for(int i=a;i<=b;++i)
10 #define rep0(i,a,b) for(int i=a;i<b;++i)
11 #define eps 1e-8
12 #define int_inf 0x3f3f3f3f
13 #define ll_inf 0x7f7f7f7f7f7f7f7f
14 #define lson (curpos<<1)
15 #define rson (curpos<<1|1)
16 /* namespace */
17 using namespace std;
18 /* header end */
19 
20 int n;
21 vector<pair<ll, ll>> v;
22 
23 int main() 
24     scanf("%d", &n);
25     for (int i = 1; i <= n; i++) 
26         pair<ll, ll> p; scanf("%lld%lld", &p.first, &p.second);
27         if (p.first || p.second) v.pb(p);
28     
29     n = (int)v.size();
30     sort(v.begin(), v.end(), [&](pair<ll, ll> a, pair<ll, ll> b) 
31         return atan2(a.second, a.first) < atan2(b.second, b.first);
32     );
33     ll ans = 0;
34     for (int i = 0; i < n; i++) 
35         int j = i; ll x = 0, y = 0;
36         for (int k = 0; k < n; k++) 
37             x += v[j].first; y += v[j].second;
38             ans = max(ans, x * x + y * y);
39             if (++j == n) j = 0;
40         
41     
42     printf("%.15f\n", sqrt(ans));
43     return 0;
44 
View Code

 

以上是关于AtCoder Beginning Contest 139的主要内容,如果未能解决你的问题,请参考以下文章

Donation---AtCoder - AtCoder Regular Contest 098

AtCoder Beginner Contest 115 题解

AtCoder Beginner Contest 154 题解

Atcoder Beginner Contest 251 D——题解

AtCoder Beginner Contest 234

AtCoder Beginner Contest 103