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 }
  • 相关阅读:
    ARM指令集----寻址方式
    [js] 实现接口
    sublime自定义配置
    [javascript] postmessage
    [javascript] visible - 待写
    [读书笔记]24个比利
    解决div里面img的缝隙问题(转)
    【JAVASCRIPT】React + Redux
    【JAVASCRIPT】React 学习
    代理
  • 原文地址:https://www.cnblogs.com/Asurudo/p/11301178.html
Copyright © 2011-2022 走看看