zoukankan      html  css  js  c++  java
  • codeforces-1201 A Important Exam

     1 #include <bits/stdc++.h>
     2 #define _for(i,a,b) for(int i = (a);i < b;i ++)
     3 typedef long long ll;
     4 using namespace std;
     5 inline ll read()
     6 {
     7     ll ans = 0;
     8     char ch = getchar(), last = ' ';
     9     while(!isdigit(ch)) last = ch, ch = getchar();
    10     while(isdigit(ch)) ans = (ans << 1) + (ans << 3) + ch - '0', ch = getchar();
    11     if(last == '-') ans = -ans;
    12     return ans;
    13 }
    14 inline void write(ll x)
    15 {
    16     if(x < 0) x = -x, putchar('-');
    17     if(x >= 10) write(x / 10);
    18     putchar(x % 10 + '0');
    19 }
    20 int n,m; 
    21 char lst[1002][1002];
    22 int gd[1002];
    23 int main()
    24 {
    25     n = read(),m = read();
    26     memset(lst,0,sizeof(lst));
    27     memset(gd,0,sizeof(gd));
    28     _for(i,0,n)
    29         scanf("%s",lst[i]);
    30     _for(i,0,m)
    31         gd[i] = read();
    32     
    33     int hash[6];
    34     int rnt = 0;
    35     _for(i,0,m)
    36     {
    37         memset(hash,0,sizeof(hash));
    38         _for(j,0,n)
    39             hash[lst[j][i]-'A'] ++;
    40         int tmax = 0;
    41         _for(j,0,6)
    42             tmax = max(tmax,hash[j]);
    43         rnt += tmax*gd[i];
    44     }
    45     write(rnt);
    46     return 0;
    47 }
  • 相关阅读:
    ASP.NET MVC 动态加载图像
    ASP.NET:以域用户身份访问网络资源
    ASP.NET MVC 动态加载 *.ascx
    4月
    3月
    2月
    每天充点小能量
    每天进步一点点
    FreeMarker标签与使用
    eclipse启动tomcat, http://localhost:8080无法访问
  • 原文地址:https://www.cnblogs.com/Asurudo/p/11301178.html
Copyright © 2011-2022 走看看