zoukankan      html  css  js  c++  java
  • cf 307

    一开始我是不想打的  又因为307这个数字太特殊了

    毕竟307  希望今天的考试不要挂掉

    http://codeforces.com/contest/551/problem/A

     1 #include<iostream>
     2 #include<cstring>
     3 #include<algorithm>
     4 using namespace std;
     5 
     6 const int maxn = 2000 + 10;
     7 int a[maxn];
     8 int b[maxn];
     9 int c[maxn];
    10 int main()
    11 {
    12     int n;
    13     while (cin >>n)
    14     {
    15         for (int i = 0;i<n;i++)
    16         {
    17             cin >> a[i];
    18             c[i] = a[i];
    19         }
    20         sort(a,a+n);
    21         for (int i = 0;i<n;i++)
    22         {
    23             b[a[i]] = n-i;
    24         }
    25         for (int i = 0;i<n;i++)
    26         {
    27             cout << b[c[i]] <<endl;
    28         }
    29     } 
    30     return 0;
    31 } 
    代码君

    http://codeforces.com/contest/551/problem/B

     1 #include<iostream>
     2 #include<cstdio>
     3 #include<cstring>
     4 #include<algorithm>
     5 
     6 
     7 using namespace std;
     8 
     9 const int inf = 999999999;
    10 const int mod = 1000000007;
    11 
    12 char c0[100000+10],c1[100000+10],c2[100000+10];
    13 int a[30],b[30],c[30];
    14 
    15 int main()
    16 {
    17     scanf("%s%s%s",c0+1,c1+1,c2+1);
    18     int l = strlen(c0+1);
    19     int l1 = strlen(c1+1);
    20     int l2 = strlen(c2+1);
    21     for (int i = 1;i<=l;i++)   a[c0[i]-96]++;
    22     for (int i = 1;i<=l1;i++)  b[c1[i]-96]++;
    23     for (int i = 1;i<=l2;i++)  c[c2[i]-96]++;
    24     int p = 0,q = 0;
    25     for (int i = 0; ; i++)
    26     {
    27         int ls = inf;
    28         bool flag = true;
    29         for (int j = 1; j <= 26; j++)
    30         {
    31             if (a[j] - b[j] * i < 0) {flag = false; break;}
    32             if (c[j]) ls = min(ls, (a[j] - b[j] * i) / c[j]);
    33         }
    34         if (!flag) break;
    35         if (i + ls > p + q) p = i, q = ls;
    36     }
    37  
    38     for (int i = 1; i <= p; i++) for (int j = 1; j <= l1; j++) printf("%c", c1[j]);
    39     for (int i = 1; i <= q; i++) for (int j = 1; j <= l2; j++) printf("%c", c2[j]);
    40     for (int i = 1; i <= 26; i++) 
    41     for (int j = 1; j <= a[i] - b[i] * p - c[i] * q; j++) 
    42     printf("%c", i + 96);
    43     return 0;
    44 }
    代码君
    爱程序 不爱bug 爱生活 不爱黑眼圈 我和你们一样 我和你们不一样 我不是凡客 我要做geek
  • 相关阅读:
    HTML: vertical algin Big/small div in same row (bootstrap)
    unix时间转换
    chrome工具分析
    DNF 包管理器
    安装nodejs
    location属性解释
    angular深入理解途径
    ui-router与ngRoute
    angular $location服务获取url
    Python文件操作
  • 原文地址:https://www.cnblogs.com/yifi/p/4573222.html
Copyright © 2011-2022 走看看