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,到场如果一个学生的出勤纪 ...
随机推荐
- linux 下创建文本的方法
1. 打开终端,输入 vi 1.txt 输入:wq 文本创建成功 2. 打开终端,输入 vim 1.txt 输入:wq 文本创建成功 3. 打开终端 , 输入 touch 1.txt ...
- mysql之explain
⊙ 使用EXPLAIN语法检查查询执行计划 ◎ 查看索引的使用情况 ◎ 查看行扫描情况 ⊙ 避免使用SELECT * ◎ 这会导致表的全扫描 ◎ 网络带宽会被浪费 话说工欲善其 ...
- spring浏览器国际化的原理
We will add two languages support to our application: English and German. Depending on the locale se ...
- Python—— *与** 参数说明
Python *与** 参数说明 '''*用来传递任意个无名字参数,这些参数会一个Tuple的形式访问''' def fall(*z): print sum(z) print "keys t ...
- php socket 函数
创建基于socket的应用程序,就需要详细了解socket的操作方法,这里列举PHP中一些重要的socket函数. 1. socket_create ( int $domain , int $ty ...
- 《你不知道的JavaScript下卷》知识点笔记
1. [1, 2, 3] == [1, 2, 3] 返回false [1, 2, 3] == “1, 2, 3” 返回true 2. 如果 < 比较的两个值都是字符串, 就像在b < c中 ...
- linux下mongodb授权登录
mongodb版本为3.2(目前最新),演示的是linux下的mongodb授权认证 第一次登录不启动授权(mongo默认不启动) ./mongod --dbpath=/home/db/data -- ...
- ElementTree 解析xml(minidom解析xml大文件时,MemoryError)
在使用minido解析xml文件时,因为文件过大,结果报错MemoryError.查询后得知是因为minidom在解析时是将所有文件放到内存里的,很占用内存,所以要考虑换一种方法来处理xml文件. ...
- 百度BAE部署微信开发环境
这里会弹出一个SVN的账户和密码,这个账户和密码就是你百度的账户和密码 将项目导出WAR包到SVN的客户端目录里面 然后右键SVN Commit提交代码 部署列表有新版本 快捷发布 tocken认证失 ...
- Django的admin介绍
我们看到我们创建一个默认的django的项目,他在project的urls有一个admin的url的路径 我们访问这个路径,他是一个登陆框,需要输入用户名和密码 我们就需要创建这个用户名和密码,如果你 ...