2019 DISCS PrO High School Division

Posted zlrrrr

tags:

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

A. Nate and Actual 3D Girls

技术图片
#include <bits/stdc++.h>
using namespace std;

const int maxn = 2e5 + 10;
int N, M, K;
string s, t;
map<char, int> mp;

int main() 
    scanf("%d%d%d", &N, &M, &K);
    K %= 26;
    while(N --) 
        cin >> s;
        for(int i = 0; s[i]; i ++)
            mp[s[i]] ++;
    
    while(M --) 
        cin >> t;
        for(int i = 0; t[i]; i ++) 
            char c;
            int num = t[i] - a + 1;
            num += K;
            num %= 26;
            c = num + a - 1;
            mp[c] --;
        
    

    bool flag = true;
    for(int i = 0; i < 26; i ++)
        if(mp[i + a] < 0) flag = false;

    if(flag) printf("Make her kokoro go doki-doki!\n");
    else printf("It is gonna be daijoubu.\n");

    return 0;
View Code

B. Nate and Bones

技术图片
#include<bits/stdc++.h>
using namespace std;

int n, m, x;

int gcd(int a, int b) 
  if(b == 0) return a;
  return gcd(b, a % b);


int main() 
  scanf("%d%d%d", &n, &m, &x);
  int ans = 0;
  for(int i = 1; i <= n * m; i ++) 
    int y;
    scanf("%d", &y);
    if(gcd(x, y) != 1) ans ++;
  
  printf("%d\n", ans);
  return 0;
View Code

C. Nate and Contest Invitation

技术图片
#include <bits/stdc++.h>
using namespace std;

const int maxn = 1e5 + 10;
int N, M, K;
vector<int> v[maxn];
map<string, int> mp;
map<string, int> vis;
int see[maxn];
vector<int> ans;
int num = 0;

void dfs(int st) 
    see[st] = 1;

    for(int i = 0; i < v[st].size(); i ++) 
        if(see[v[st][i]] == 0) 
            dfs(v[st][i]);
            num ++;
        
    


int main() 
    scanf("%d%d%d", &N, &M, &K);
    mp.clear();
    vis.clear();
    memset(see, 0, sizeof(see));
    int cnt = 0;
    while(M --) 
        string st, en;
        cin >> st >> en;
        if(!vis[st]) 
            cnt ++;
            mp[st] = cnt;
            vis[st] = 1;
        
        if(!vis[en]) 
            cnt ++;
            mp[en] = cnt;
            vis[en] = 1;
        

        v[mp[st]].push_back(mp[en]);
        v[mp[en]].push_back(mp[st]);
    

    for(int i = 1; i <= cnt; i ++) 
        if(see[i] == 0) 
            num = 1;
            dfs(i);
            ans.push_back(num);
        
    

    int sum = 0;
    int out = 0;
    for(int i = 0; i < ans.size(); i ++)
        sum += ans[i];

    sort(ans.rbegin(), ans.rend());

    if(sum == N) 
        K = min((int)ans.size(), K);
        for(int i = 0; i < K; i ++)
            out += ans[i];
     else 
        if(K > (int)ans.size()) 
            out = sum + (K - (int)ans.size());
         else 
            K = min((int)ans.size(), K);
            for(int i = 0; i < K; i ++)
                out += ans[i];
        
    

    printf("%d\n", min(N, out));

    return 0;
View Code

D. Nate and Dimension-Hopping Money

技术图片
#include<bits/stdc++.h>
using namespace std;

double a[10], x, y;

int main() 
  scanf("%lf%lf%lf", &a[1], &x, &y);

  a[2] = a[1] / (1 - (1 - x / 100) + (1 - y / 100) * (1 - x / 100));

  a[3] = (1 - x / 100) * a[2];

  a[4] = (1 - y / 100) * a[3];

  a[5] = a[4];

  printf("%.4f %.4f %.4f %.4f %.4f\n", a[1], a[2], a[3], a[4], a[5]);
  return 0;
View Code

F. Nate and Fan Meet-and-Greet

技术图片
#include <bits/stdc++.h>
using namespace std;

long long N;

int main() 
    scanf("%lld", &N);
    printf("%lld\n", N);
    return 0;
View Code

G. Nate and Game

技术图片
#include<bits/stdc++.h>
using namespace std;

const int maxn = 200000 + 10;
int n;
struct P 
  int L, R;
s[maxn];

bool cmp(const P &a, const P &b) 
  return a.L < b.L;


int main() 
  scanf("%d", &n);
  for(int i = 1; i <= n; i ++) 
    int ymin = 2000000, ymax = -2000000;
    for(int j = 1; j <= 3; j ++) 
      int x, y;
      scanf("%d%d", &x, &y);
      ymin = min(ymin, y);
      ymax = max(ymax, y);
    
    s[i].L = ymin;
    s[i].R = ymax;
  

  sort(s + 1, s + n + 1, cmp);

  for(int i = 1; i <= n; i ++) 
  //  printf("[%d, %d]\n", s[i].L, s[i].R);
  

  int ans = 0;
  int sz = 0;

  priority_queue<int> Q;

  int t = 1;

  for(int i = -1000000; i <= 1000000; i ++) 
    while(t <= n && s[t].L == i) 
      Q.push(-s[t].R);
      t ++;
      sz ++;
    

    ans = max(ans, sz);

    while((!Q.empty()) && -1 * Q.top() == i) 
      Q.pop();
      sz --;
    
  

  ans = max(ans, sz);

  printf("%d\n", ans);

  return 0;
View Code

 

情侣局 ++

数学题专场???打扰了!

以上是关于2019 DISCS PrO High School Division的主要内容,如果未能解决你的问题,请参考以下文章

打开内置 Macbook pro 摄像头时出错

MacBook Pro(13 英寸,2011 年末)A1278 官方最高支持macOS High Sierra,使用macOS Catalina Patcher成功安装macOS Catalina

sql 显示有关如何创建其ID随插入的每个新记录而增加的表的语法和注释。代码取自:http://www.w3schoo

Colab Pro+ 没有额外的内存

2019.9.24-快速排序实现(完整代码)

bash:pip:命令找不到mac os high sierra