公式
A - Required Length 解説 by en_translator
It is sufficient to determine if the string \(P\) has length \(L\) or greater.
Most string types come with a function to find the length of a string, such as the member function std::size()
for std::string
in C++ and the builtin function len()
for the str
type in Python. One may use these functions to check the length.
All that left is to combine this with an if
statement.
Sample code in C++:
#include <bits/stdc++.h>
using namespace std;
int main() {
string p;
int l;
cin>>p;
cin>>l;
if(p.size()>=l)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
return 0;
}
Sample code in Python:
p=input()
l=int(input())
if len(p)>=l:
print("Yes")
else:
print("No")
投稿日時:
最終更新: