题解 | 字母收集

字母收集

https://www.nowcoder.com/practice/9740ce2df0a04399a5ade1927d34c1e1

import java.util.Scanner;
import java.io.*;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        String[] arr=reader.readLine().split(" ");
        int n=Integer.parseInt(arr[0]);
        int m=Integer.parseInt(arr[1]);
        int[][] tmp=new int[n+2][m+2];
        for(int i=1;i<=n;i++){
            String s=reader.readLine();
            for(int j=1;j<=m;j++){
                char c=s.charAt(j-1);
                if(c=='l'){
                    tmp[i][j]+=4;
                }else if(c=='o'){
                    tmp[i][j]+=3;
                }else if(c=='v'){
                    tmp[i][j]+=2;
                }else if(c=='e'){
                    tmp[i][j]+=1;
                }else{
                    tmp[i][j]+=0;
                }
            }
        }
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                tmp[i][j]+=Math.max(tmp[i-1][j],tmp[i][j-1]);
            }
        }
        System.out.print(tmp[n][m]);
    }
}

全部评论

相关推荐

Jcwemz:中软证书写单行,考了什么学了什么相关技术栈的内容就说自己会什么, 没实习就包装实习简历,将项目经历写成实习做的,项目时间拉长,项目成果具体化,测试的项目成果无非就是写了多少用例查出了多少bug,重要的不是实习了多久,而是你会多少东西,你能表达的就都是你的。 cet4,随便找个地方标上就好了,不用写单行。 粗略建议,我也不在行,觉得对的可以采纳
实习,投递多份简历没人回...
点赞 评论 收藏
分享
程序员花海:实习和校招简历正确格式应该是教育背景+实习+项目经历+个人评价 其中项目经历注意要体现业务 实习经历里面的业务更是要自圆其说 简历模板尽可能保持干净整洁 不要太花哨的
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务