会员专享
请先
登录,登录后可使用今日免费解锁;
开通会员,或
购买
该题目所属题库
,可解锁完整内容。
思路:模拟+哈希表
step1:题目简化
实现一个用户注册登录逻辑
step2:思路:模拟
1.先读入数据,按空格分割字符串。这里对于cpp/c选手最麻烦。其他语言都有封装好的split函数
P1665.2024.1.30-后端开发机试-第二题
As an intern at Amazon, you have been assigned a task to implement the sign-in pages inthe Amazon Dummy Website.
There are three sign-in pages, each with its own APl:
|
Register |
Login |
Logout |
| Function |
Registers a newuser with the username and password |
Verifies the username and password, then grants or denies access |
username logs out of the website |
| API Request |
register <username> <password> |
login <username> <password> |
logout <username> |
| Returns |
1.lf the registrationwas successful,Registered Successfully 2.lf the user already exists,Username already exists |
1.lf the login was successful, Logged In Successfully 2.If the login was unsuccessful,Login Unsuccessful |
lf the logout was successful, Logged Out Successfully lf the given username wasn't logged in, Logout Unsuccessful |
Given a log of APl requests, return the list of returns from the mock website.