Codeforces Round #532 (Div. 2)

时间:2023-01-22 19:28:12

Codeforces Round #532 (Div. 2)

A - Roman and Browser

 #include<bits/stdc++.h>
 #include<iostream>
 #include<cstdio>
 #include<cstdlib>
 #include<cstring>
 #include<cmath>
 #include<algorithm>
 #include<queue>
 #include<vector>
 #include<map>
 #define lson i<<1
 #define rson i<<1|1
 #define LS l,mid,lson
 #define RS mid+1,r,rson
 #define mem(a,x) memset(a,x,sizeof(a))
 #define gcd(a,b) __gcd(a,b)
 #define ll long long
 #define ull unsigned long long
 #define lowbit(x) (x&-x)
 #define pb(x) push_back(x)
 #define enld endl
 #define mian main
 #define itn int
 #define prinft printf
 #pragma GCC optimize(2)
 //#pragma comment(linker, "/STACK:102400000,102400000")

 const double PI = acos (-1.0);
 const int INF = 0x3f3f3f3f;
 ;
 ;
 ;
 ;

 using namespace std;

 int n, k, ans;
 ];
 int cnt1, cnt2;

 int main() {
     cin >> n >> k;
     cnt1 = cnt2 = ans = ;
     ; i <= n; ++i) {
         cin >> a[i];
         ) {
             cnt1++;
         } else {
             cnt2++;
         }
     }
     int t1, t2;
     ; i <= ; ++i) {
         t1 = t2 = ;
         ; i + j * k <= n; ++j) {

             ) {
                 t1++;
             } ) {
                 t2++;
             }
         }
         ans = max(ans, abs((cnt1 - t1) - (cnt2 - t2)));
     }
     cout << ans << endl;
 }

A

B - Build a Contest

 #include<bits/stdc++.h>
 #include<iostream>
 #include<cstdio>
 #include<cstdlib>
 #include<cstring>
 #include<cmath>
 #include<algorithm>
 #include<queue>
 #include<vector>
 #include<map>
 #define lson i<<1
 #define rson i<<1|1
 #define LS l,mid,lson
 #define RS mid+1,r,rson
 #define mem(a,x) memset(a,x,sizeof(a))
 #define gcd(a,b) __gcd(a,b)
 #define ll long long
 #define ull unsigned long long
 #define lowbit(x) (x&-x)
 #define pb(x) push_back(x)
 #define enld endl
 #define mian main
 #define itn int
 #define prinft printf
 #pragma GCC optimize(2)
 //#pragma comment(linker, "/STACK:102400000,102400000")

 const double PI = acos (-1.0);
 const int INF = 0x3f3f3f3f;
 ;
 ;
 ;
 ;

 using namespace std;

 int n, m, tmp;
 queue<int> q;
 queue<int> qt;
 int vis[MAXN];

 int main() {
     cin >> n >> m;
     ; i <= m; ++i) {
         cin >> tmp;
         if(!vis[tmp]) {
             q.push(tmp);
         }
         vis[tmp]++;
         if(q.size() == n) {
             int cnt = n;
             while(cnt--) {
                 vis[q.front()]--;
                 if(vis[q.front()])
                     q.push(q.front());
                 q.pop();
             }
             cout << ;
         } else
             cout << ;
     }
     cout << endl;
 }

B

C

 #include<bits/stdc++.h>
 #include<iostream>
 #include<cstdio>
 #include<cstdlib>
 #include<cstring>
 #include<cmath>
 #include<algorithm>
 #include<queue>
 #include<vector>
 #include<map>
 #define lson i<<1
 #define rson i<<1|1
 #define LS l,mid,lson
 #define RS mid+1,r,rson
 #define mem(a,x) memset(a,x,sizeof(a))
 #define gcd(a,b) __gcd(a,b)
 #define ll long long
 #define ull unsigned long long
 #define lowbit(x) (x&-x)
 #define pb(x) push_back(x)
 #define enld endl
 #define mian main
 #define itn int
 #define prinft printf
 #pragma GCC optimize(2)
 //#pragma comment(linker, "/STACK:102400000,102400000")

 const double PI = acos (-1.0);
 const int INF = 0x3f3f3f3f;
 ;
 ;
 ;
 ;

 using namespace std;

 double n,r;

 int main()
 {
     cin>>n>>r;
     printf(-sin(PI/n))*r);
 }

C