← 返回 coinbase 的题目列表Recipe Management System
类型:online_judge
Implement a Recipe Management System with the following features:
Add Recipe: Allow adding new recipe information.
Update Recipe: Allow updating existing recipe information.
Get Recipe: Retrieve specified recipe information.
Delete Recipe: Delete specified recipe.
Advanced Features:
Search Recipe: Implement case-insensitive search functionality.
List Sort: Enable sorting recipes by size or name.
Add User: Simple user addition feature.
Version History and Rollback: Record each operation with version and version ID, supporting rollback functionality.
Input
A series of commands, e.g., ADD name size for adding and UPDATE name new_size for updating.
GET name for fetching recipe info, DELETE name for deletion.
SEARCH keyword for searching recipes containing the keyword.
LIST SORT size or LIST SORT name for sorting.
ADDUSER user_name for adding a user.
ROLLBACK version_id for rollback to a specific version.
Output
Output corresponding results or error information for each command executed.
Constraints
Recipe and username must not exceed 100 characters.
Total version history must not exceed 1000 entries.
Example
ADD "Pasta" 5
GET "Pasta"
UPDATE "Pasta" 10
DELETE "Pasta"
SEARCH "Pas"
LIST SORT size
ADDUSER "Alice"
ROLLBACK 1
Example
Input
ADD "Pasta" 5
GET "Pasta"