551. Student Attendance Record I
static int wing=[]()
{
std::ios::sync_with_stdio(false);
cin.tie(NULL);
return ;
}(); class Solution
{
public:
bool checkRecord(string s)
{
int countA=;
int len=s.length();
for(int i=;i<len;i++)
{
if(s[i]=='A')
countA++;
if(s[i]=='L')
{
if(i+<len&&s[i+]=='L'&&s[i+]=='L')
return false;
}
}
return countA>? false:true;
}
};
简单,问题不大
551. Student Attendance Record I的更多相关文章
- 551. Student Attendance Record I【easy】
551. Student Attendance Record I[easy] You are given a string representing an attendance record for ...
- 【leetcode_easy】551. Student Attendance Record I
problem 551. Student Attendance Record I 题意: solution: class Solution { public: bool checkRecord(str ...
- 551. Student Attendance Record I 从字符串判断学生考勤
[抄题]: You are given a string representing an attendance record for a student. The record only contai ...
- 551. Student Attendance Record I + Student Attendance Record II
▶ 一个学生的考勤状况是一个字符串,其中各字符的含义是:A 缺勤,L 迟到,P 正常.如果一个学生考勤状况中 A 不超过一个,且没有连续两个 L(L 可以有多个,但是不能连续),则称该学生达标(原文表 ...
- [LeetCode&Python] Problem 551. Student Attendance Record I
You are given a string representing an attendance record for a student. The record only contains the ...
- LeetCode 551. Student Attendance Record I (C++)
题目: You are given a string representing an attendance record for a student. The record only contains ...
- LeetCode 551. Student Attendance Record I (学生出勤纪录 I)
You are given a string representing an attendance record for a student. The record only contains the ...
- 【LeetCode】551. Student Attendance Record I 解题报告(Java & Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 正则表达式 统计 日期 题目地址:https://l ...
- 551 Student Attendance Record I 学生出勤纪录 I
给定一个字符串来代表一个学生的出勤纪录,这个纪录仅包含以下三个字符: 'A' : Absent,缺勤 'L' : Late,迟到 'P' : Present,到场如果一个学生的出勤纪 ...
随机推荐
- Python函数名为参数
1.定义两个函数,求和函数和最大函数 def add(x, y): return x + y def maxnum(x, y): return x if x > y else y lst= [2 ...
- leetcode941
public class Solution { public bool ValidMountainArray(int[] A) { bool findTop = false; ) { return f ...
- DDoS攻防战 (一) : 概述
岁寒 然后知松柏之后凋也 ——论语·子罕 (此图摘自<Web脚本攻击与防御技术核心剖析>一书,作者:郝永清先生) DDoS,即 Distributed Denial of Servi ...
- 用meta标签让双核浏览器用我们指定的内核渲染
<html> <head> <meta name="renderer" content="webkit|ie-comp|ie-stand&q ...
- springVC + logback
为什么用logback,而不是log4j? springmvc log只输出到console,不输出到文件 Spring MVC集成slf4j-logback springMVC如何配置logback ...
- 机器学习入门-DBSCAN聚类算法
DBSCAN 聚类算法又称为密度聚类,是一种不断发张下线而不断扩张的算法,主要的参数是半径r和k值 DBSCAN的几个概念: 核心对象:某个点的密度达到算法设定的阈值则其为核心点,核心点的意思就是一个 ...
- SpringMvc 获取ApplicationContext
有时,我们不通过Controller层进入Service层,比如同步数据,任务,以及文件上传共通Handler对文件处理后保存数据等都会由一个非Controller类调用Service. 这时候如果n ...
- 前端-CSS-3-高级选择器
高级选择器 总结: <!-- 总结: 基础选择器: 1.标签选择器 div 2.类选择器 .div1 3.id选择器 #box 4.通配符选择器 * 高级选择器: 1.群组选择器 中间用, .t ...
- ssh 免密码登录,以及 本地和远端用户名不一致 问题
ssh 远程登录 ssh -l u1 u1@192.168.0.7 ssh u1@192.168.0.7 每次远程都要输入 用户名,密码 比较麻烦.所以比较好的是免密码登录 1.安装ssh服务器 su ...
- 清理数据库errorlog
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOGERRORLOGERRORLOG.1ERRORLOG.2ERRORLOG.3ERRORLO ...